autoupdate.yml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. name: auto-update PRs & label conflicts
  2. on:
  3. push:
  4. branches:
  5. - main
  6. # can also be used with the pull_request event
  7. pull_request_target:
  8. types:
  9. - synchronize
  10. # allow the workflow to correct any label incorrectly added or removed by a user.
  11. - labeled
  12. - unlabeled
  13. # update the PR as soon as the auto-merge is enabled.
  14. - auto_merge_enabled
  15. # process the PR once they appear in the search filters
  16. - ready_for_review
  17. - opened
  18. - reopened
  19. jobs:
  20. autoupdate:
  21. runs-on: ubuntu-latest
  22. steps:
  23. # This step is used by the fork update feature, which uses git instead of the API
  24. - name: Configure git
  25. env:
  26. UPDATE_FORK_USERNAME: '${{ vars.UPDATE_FORK_USERNAME }}'
  27. UPDATE_FORK_EMAIL: '${{ vars.UPDATE_FORK_EMAIL }}'
  28. run: |
  29. # The username of the "UPDATE_FORK_PAT" owner
  30. git config --global user.name "${UPDATE_FORK_USERNAME}"
  31. # The email of the "UPDATE_FORK_PAT" owner
  32. git config --global user.email "${UPDATE_FORK_EMAIL}"
  33. - name: Generate Sequelize Bot Token
  34. id: generate-token
  35. uses: actions/create-github-app-token@v1
  36. with:
  37. app-id: '${{ secrets.SEQUELIZE_BOT_APP_ID }}'
  38. private-key: '${{ secrets.SEQUELIZE_BOT_PRIVATE_KEY }}'
  39. - uses: sequelize/pr-auto-update-and-handle-conflicts@74929c430b8843e691e7b83d229d8d13d78d89e3 # 2.0.0
  40. with:
  41. conflict-label: 'conflicted'
  42. conflict-requires-ready-state: 'ready_for_review'
  43. conflict-excluded-authors: 'bot/renovate'
  44. update-pr-branches: true
  45. update-requires-auto-merge: true
  46. update-requires-ready-state: 'ready_for_review'
  47. update-excluded-authors: 'bot/renovate'
  48. update-excluded-labels: 'no-autoupdate'
  49. env:
  50. # We need to use a GitHub App PAT to update PRs
  51. # or workflows will not be triggered by the update
  52. GITHUB_TOKEN: '${{ steps.generate-token.outputs.token }}'
  53. # updating forks require a user PAT instead of an app PAT,
  54. # as the permissions of the app PAT do not apply to forks.
  55. UPDATE_FORK_PAT: '${{ secrets.UPDATE_FORK_PAT }}'
  56. UPDATE_FORK_USERNAME: '${{ vars.UPDATE_FORK_USERNAME }}'