label_prs.yaml 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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: 'Auto label PRs'
  5. on:
  6. pull_request_target:
  7. types: [opened, ready_for_review]
  8. permissions:
  9. pull-requests: write # For gh to edit labels.
  10. jobs:
  11. assign_reviewer:
  12. runs-on: ubuntu-latest
  13. steps:
  14. - name: Harden Runner
  15. uses: step-security/harden-runner@63c24ba6bd7ba022e95695ff85de572c04a18142 # v2.7.0
  16. with:
  17. egress-policy: audit
  18. - id: filter
  19. uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
  20. with:
  21. filters: |
  22. documentation:
  23. - '*.md'
  24. - 'docs/**'
  25. explorer:
  26. - 'explorer/**'
  27. infrastructure:
  28. - 'BUILD'
  29. - 'WORKSPACE'
  30. - '.*'
  31. - '.*/**'
  32. - 'bazel/**'
  33. - 'scripts/**'
  34. toolchain:
  35. - 'toolchain/**'
  36. - id: documentation
  37. if: steps.filter.outputs.docs == 'true'
  38. run: |
  39. gh pr edit "${PR}" --add-label "documentation"
  40. env:
  41. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  42. PR: ${{ github.event.pull_request.html_url }}
  43. - id: explorer
  44. if: steps.filter.outputs.explorer == 'true'
  45. run: |
  46. gh pr edit "${PR}" --add-label "explorer"
  47. env:
  48. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  49. PR: ${{ github.event.pull_request.html_url }}
  50. - id: infrastructure
  51. if: steps.filter.outputs.docs == 'true'
  52. run: |
  53. gh pr edit "${PR}" --add-label "infrastructure"
  54. env:
  55. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  56. PR: ${{ github.event.pull_request.html_url }}
  57. - id: toolchain
  58. if: steps.filter.outputs.toolchain == 'true'
  59. run: |
  60. gh pr edit "${PR}" --add-label "toolchain"
  61. env:
  62. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  63. PR: ${{ github.event.pull_request.html_url }}