check_dependent_pr.yaml 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # Part of the Carbon Language project, under the Apache License v2.0 with LLVM
  2. # Exceptions. See /LICENSE for license information.
  3. # SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
  4. name: 'Check Dependent PRs'
  5. on:
  6. pull_request_target:
  7. types: [opened, synchronize, ready_for_review, closed]
  8. concurrency:
  9. group: ${{ github.workflow }}-${{ github.event.pull_request.number }}
  10. cancel-in-progress: true
  11. permissions:
  12. contents: read
  13. pull-requests: write
  14. jobs:
  15. check_dependent_prs:
  16. runs-on: ubuntu-latest
  17. steps:
  18. - name: Harden Runner
  19. uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
  20. with:
  21. disable-sudo: true
  22. egress-policy: block
  23. allowed-endpoints: >
  24. api.github.com:443 github.com:443 pypi.org:443
  25. files.pythonhosted.org:443
  26. # Note: pull_request_target checks out the base branch by default.
  27. # This is safe as it avoids running untrusted code from the PR branch.
  28. - name: Checkout code
  29. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  30. - name: Install dependencies
  31. run: |
  32. python3 -m pip install gql==2.0.0 requests
  33. - name: Check Dependent PR
  34. run: |
  35. if [ "$EVENT_ACTION" = "closed" ]; then
  36. python3 github_tools/check_dependent_pr.py --scan
  37. else
  38. python3 github_tools/check_dependent_pr.py --pr-number "${PR_NUMBER}"
  39. fi
  40. env:
  41. GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  42. PR_NUMBER: ${{ github.event.pull_request.number }}
  43. EVENT_ACTION: ${{ github.event.action }}