check_dependent_pr.yaml 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  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. statuses: write
  15. jobs:
  16. check_dependent_prs:
  17. runs-on: ubuntu-latest
  18. steps:
  19. - name: Harden Runner
  20. uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
  21. with:
  22. disable-sudo: true
  23. egress-policy: block
  24. allowed-endpoints: >
  25. api.github.com:443 github.com:443 pypi.org:443
  26. files.pythonhosted.org:443
  27. # Note: pull_request_target checks out the base branch by default.
  28. # This is safe as it avoids running untrusted code from the PR branch.
  29. - name: Checkout code
  30. uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
  31. - name: Install dependencies
  32. run: |
  33. python3 -m pip install gql==2.0.0 requests
  34. - name: Check Dependent PR
  35. run: |
  36. if [ "$EVENT_ACTION" = "closed" ]; then
  37. python3 github_tools/check_dependent_pr.py --scan
  38. else
  39. python3 github_tools/check_dependent_pr.py --pr-number "${PR_NUMBER}"
  40. fi
  41. env:
  42. GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  43. PR_NUMBER: ${{ github.event.pull_request.number }}
  44. EVENT_ACTION: ${{ github.event.action }}