pr-label-strip.yaml 863 B

1234567891011121314151617181920212223242526
  1. name: Strip safe-to-test on PR update
  2. # When new commits land on a PR, automatically remove the `safe-to-test` label
  3. # so the cloud integration workflow cannot be re-triggered against unreviewed
  4. # code. A maintainer must re-apply the label after reviewing the new diff.
  5. on:
  6. pull_request_target:
  7. types: [synchronize]
  8. permissions:
  9. pull-requests: write
  10. jobs:
  11. strip:
  12. runs-on: ubuntu-latest
  13. steps:
  14. - name: Remove safe-to-test label
  15. env:
  16. GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  17. GH_REPO: ${{ github.repository }}
  18. PR_NUMBER: ${{ github.event.pull_request.number }}
  19. # `gh pr edit --remove-label` exits non-zero if the label isn't
  20. # present; that's the common case (most PRs are never labeled), so
  21. # swallow it.
  22. run: gh pr edit "$PR_NUMBER" --remove-label safe-to-test || true