migrations-approval.yml 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. name: migrations approval
  2. on:
  3. pull_request:
  4. types: [review_requested, synchronize, opened, reopened]
  5. pull_request_review:
  6. types: [submitted, edited, dismissed]
  7. # Cancel in progress workflows on pull_requests.
  8. # https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
  9. concurrency:
  10. group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  11. cancel-in-progress: true
  12. defaults:
  13. run:
  14. # the default default is:
  15. # bash --noprofile --norc -eo pipefail {0}
  16. shell: bash --noprofile --norc -eo pipefail -ux {0}
  17. jobs:
  18. did-migration-change:
  19. name: check if any migration changes
  20. runs-on: ubuntu-22.04
  21. timeout-minutes: 3
  22. # Map a step output to a job output
  23. outputs:
  24. added: ${{ steps.changes.outputs.migrations_added }}
  25. modified: ${{ steps.changes.outputs.migrations_modified }}
  26. steps:
  27. - name: Checkout sentry
  28. uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
  29. - name: Match migration files
  30. uses: dorny/paths-filter@0bc4621a3135347011ad047f9ecf449bf72ce2bd # v3.0.0
  31. id: changes
  32. with:
  33. token: ${{ github.token }}
  34. filters: .github/file-filters.yml
  35. check-migration-approval:
  36. name: check if migration is approved
  37. runs-on: ubuntu-22.04
  38. timeout-minutes: 3
  39. needs: did-migration-change
  40. if: needs.did-migration-change.outputs.added == 'true'
  41. steps:
  42. - uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
  43. with:
  44. persist-credentials: false
  45. - name: getsentry token
  46. uses: getsentry/action-github-app-token@97c9e23528286821f97fba885c1b1123284b29cc # v2.0.0
  47. id: getsentry
  48. with:
  49. app_id: ${{ vars.SENTRY_INTERNAL_APP_ID }}
  50. private_key: ${{ secrets.SENTRY_INTERNAL_APP_PRIVATE_KEY }}
  51. - uses: actions/github-script@d556feaca394842dc55e4734bf3bb9f685482fa0 # v6.3.3
  52. with:
  53. github-token: ${{ steps.getsentry.outputs.token }}
  54. script: |
  55. const {check} = require(`${process.env.GITHUB_WORKSPACE}/.github/workflows/scripts/team-approval-check`);
  56. await check({ github, context, core, team_slug: 'owners-migrations' });