From 14d4ef0729b5690fa2c4ad660b2b50edbc7f6d8d Mon Sep 17 00:00:00 2001 From: jyejare Date: Wed, 19 Jul 2023 18:26:39 +0530 Subject: [PATCH] GHA for T2 only reviews --- .github/workflows/t2_reviews.yaml | 38 +++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 .github/workflows/t2_reviews.yaml diff --git a/.github/workflows/t2_reviews.yaml b/.github/workflows/t2_reviews.yaml new file mode 100644 index 00000000000..7aff2def120 --- /dev/null +++ b/.github/workflows/t2_reviews.yaml @@ -0,0 +1,38 @@ +# Github Action to Automatically assign T2 Reviewers to framework touched PRs +name: Auto assign T2 Reviewers + +on: + pull_request: + paths: ['*', '.github/**', 'conf/**', 'pytest_fixtures/core/*', 'pytest_plugins/**', 'robottelo/**', '!robottelo/constants/*', 'scripts/**'] + +env: + NUMBER: ${{ github.event.number }} + REVIEWERS: '["robottelo-tier-2-reviewers"]' + LABELS: '["Framework Changes"]' + SATQE_TOKEN: ${{ secrets.CHERRYPICK_PAT }} + +jobs: + assign-reviewers-and-labels: + name: Assign T2 Reviewers and Labels to the PR + runs-on: ubuntu-latest + steps: + - name: Add Labels to the PR + run: | + echo "Adding applicable labels to the PR $NUMBER" + curl -L -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $SATQE_TOKEN" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/SatelliteQE/robottelo/issues/$NUMBER/labels \ + -d '{"labels": '"$LABELS"'}' + + - name: Assign T2 Reviewers Team to the PR + run: | + echo "Assigning T2 Reviewers to the PR $number" + curl -L \ + -X POST \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer $SATQE_TOKEN" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + https://api.github.com/repos/SatelliteQE/robottelo/pulls/$NUMBER/requested_reviewers \ + -d '{"team_reviewers": '"${REVIEWERS}"'}'