command-rebase.yml 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. # This workflow is provided via the organization template repository
  2. #
  3. # https://github.com/nextcloud/.github
  4. # https://docs.github.com/en/actions/learn-github-actions/sharing-workflows-with-your-organization
  5. name: Rebase command
  6. on:
  7. issue_comment:
  8. types: created
  9. jobs:
  10. rebase:
  11. runs-on: ubuntu-latest
  12. # On pull requests and if the comment starts with `/rebase`
  13. if: github.event.issue.pull_request != '' && startsWith(github.event.comment.body, '/rebase')
  14. steps:
  15. - name: Add reaction on start
  16. uses: peter-evans/create-or-update-comment@v2
  17. with:
  18. token: ${{ secrets.COMMAND_BOT_PAT }}
  19. repository: ${{ github.event.repository.full_name }}
  20. comment-id: ${{ github.event.comment.id }}
  21. reaction-type: "+1"
  22. - name: Checkout the latest code
  23. uses: actions/checkout@v3
  24. with:
  25. fetch-depth: 0
  26. token: ${{ secrets.COMMAND_BOT_PAT }}
  27. - name: Automatic Rebase
  28. uses: cirrus-actions/rebase@1.6
  29. env:
  30. GITHUB_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}
  31. - name: Add reaction on failure
  32. uses: peter-evans/create-or-update-comment@v2
  33. if: failure()
  34. with:
  35. token: ${{ secrets.COMMAND_BOT_PAT }}
  36. repository: ${{ github.event.repository.full_name }}
  37. comment-id: ${{ github.event.comment.id }}
  38. reaction-type: "-1"