[BugFix] Capture resource group for scan task (backport #51121) #4244
This file contains 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: LABEL ACTION | |
on: | |
pull_request_target: | |
types: | |
- labeled | |
- unlabeled | |
permissions: | |
checks: write | |
actions: write | |
contents: write | |
deployments: write | |
discussions: write | |
issues: write | |
packages: write | |
pages: write | |
pull-requests: write | |
repository-projects: write | |
security-events: write | |
statuses: write | |
jobs: | |
meta-review: | |
name: META REVIEW LABEL | |
if: github.event.label.name == 'META-REVIEW' | |
runs-on: ubuntu-latest | |
env: | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
META_TEAM: meta-committer | |
GH_TOKEN: ${{ secrets.PAT }} | |
steps: | |
- name: ADD REVIEWER | |
if: github.event.action == 'labeled' | |
run: | | |
gh api \ | |
--method POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/${{ github.repository }}/pulls/${PR_NUMBER}/requested_reviewers \ | |
-f "reviewers[]=" -f "team_reviewers[]=${META_TEAM}" 1>/dev/null | |
- name: REMOVE REVIEWER | |
if: github.event.action == 'unlabeled' | |
run: | | |
gh api \ | |
--method DELETE \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/${{ github.repository }}/pulls/${PR_NUMBER}/requested_reviewers \ | |
-f "reviewers[]=" -f "team_reviewers[]=${META_TEAM}" 1>/dev/null | |
proto-review: | |
name: PROTO REVIEW LABEL | |
if: github.event.label.name == 'PROTO-REVIEW' | |
runs-on: ubuntu-latest | |
env: | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
PROTO_TEAM: proto-team | |
GH_TOKEN: ${{ secrets.PAT }} | |
steps: | |
- name: ADD REVIEWER | |
if: github.event.action == 'labeled' | |
run: | | |
gh api \ | |
--method POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/${{ github.repository }}/pulls/${PR_NUMBER}/requested_reviewers \ | |
-f "reviewers[]=" -f "team_reviewers[]=${PROTO_TEAM}" 1>/dev/null | |
- name: REMOVE REVIEWER | |
if: github.event.action == 'unlabeled' | |
run: | | |
gh api \ | |
--method DELETE \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/${{ github.repository }}/pulls/${PR_NUMBER}/requested_reviewers \ | |
-f "reviewers[]=" -f "team_reviewers[]=${PROTO_TEAM}" 1>/dev/null | |
feature-review: | |
name: FEATURE REVIEW LABEL | |
if: github.event.label.name == 'feature' | |
runs-on: ubuntu-latest | |
env: | |
PR_NUMBER: ${{ github.event.pull_request.number }} | |
TEAM: feature-reviewer | |
GH_TOKEN: ${{ secrets.PAT }} | |
steps: | |
- name: ADD REVIEWER | |
if: github.event.action == 'labeled' | |
run: | | |
gh api \ | |
--method POST \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/${{ github.repository }}/pulls/${PR_NUMBER}/requested_reviewers \ | |
-f "reviewers[]=" -f "team_reviewers[]=${TEAM}" 1>/dev/null | |
- name: REMOVE REVIEWER | |
if: github.event.action == 'unlabeled' | |
run: | | |
gh api \ | |
--method DELETE \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
/repos/${{ github.repository }}/pulls/${PR_NUMBER}/requested_reviewers \ | |
-f "reviewers[]=" -f "team_reviewers[]=${TEAM}" 1>/dev/null |