check_dependent.yaml 1.1 KB

123456789101112131415161718192021222324252627282930313233
  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 Label
  5. on:
  6. pull_request_target:
  7. types: [opened, synchronize, labeled, unlabeled]
  8. # This workflow runs as `pull_request_target` so that the check can't be
  9. # disabled or bypassed by the PR, but it doesn't need any permissions.
  10. permissions: {}
  11. jobs:
  12. check_label:
  13. runs-on: ubuntu-latest
  14. steps:
  15. - name: Harden Runner
  16. uses: step-security/harden-runner@58077d3c7e43986b6b15fba718e8ea69e387dfcc # v2.15.1
  17. with:
  18. disable-sudo: true
  19. egress-policy: block
  20. # prettier-ignore
  21. allowed-endpoints: >
  22. api.github.com:443
  23. - name: Check for 'dependent' label
  24. run: |
  25. if [[ "${{ contains(github.event.pull_request.labels.*.name, 'dependent') }}" == "true" ]]; then
  26. echo "PR has 'dependent' label. Blocking merge."
  27. exit 1
  28. fi
  29. echo "PR does not have 'dependent' label."