[Gov. Review]: KubeVirt #2762
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Auto Label Issues and PRs | |
| on: | |
| issues: | |
| types: [opened, edited, reopened, transferred] | |
| pull_request_target: | |
| types: [opened, edited, reopened] | |
| jobs: | |
| label: | |
| permissions: | |
| contents: read | |
| issues: write | |
| pull-requests: write | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout PR head for changed-files | |
| if: ${{ github.event.pull_request }} | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.sha }} | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Checkout repository for issue events | |
| if: ${{ !github.event.pull_request }} | |
| uses: actions/checkout@v5 | |
| with: | |
| persist-credentials: false | |
| - name: Get changed files from PR API | |
| if: ${{ github.event.pull_request }} | |
| id: changed-files | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const prNumber = context.payload.pull_request.number; | |
| const files = await github.paginate(github.rest.pulls.listFiles, { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| pull_number: prNumber, | |
| per_page: 100 | |
| }); | |
| core.setOutput("all_changed_files", files.map(f => f.filename).join(",")); | |
| - name: Run labeler action for PR | |
| if: ${{ github.event.pull_request }} | |
| uses: cncf/automation/.github/actions/labeler-action@66a552b17f013289688a4e238f7a64b0d8e334a6 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| labels: https://raw.githubusercontent.com/cncf/toc/refs/heads/main/.github/labels.yaml | |
| owner: ${{ github.repository_owner }} | |
| repo: ${{ github.event.repository.name }} | |
| issue_number: ${{ github.event.pull_request.number }} | |
| comment_body: ${{ github.event.pull_request.body }} | |
| changed_files: ${{ steps.changed-files.outputs.all_changed_files }} | |
| - name: Run labeler action for Issue | |
| if: ${{ !github.event.pull_request }} | |
| uses: cncf/automation/.github/actions/labeler-action@66a552b17f013289688a4e238f7a64b0d8e334a6 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| labels: https://raw.githubusercontent.com/cncf/toc/refs/heads/main/.github/labels.yaml | |
| owner: ${{ github.repository_owner }} | |
| repo: ${{ github.event.repository.name }} | |
| issue_number: ${{ github.event.issue.number }} | |
| comment_body: ${{ github.event.issue.body }} |