From a20b84f5b2dcbf19729fc640019f306b07c3a636 Mon Sep 17 00:00:00 2001 From: Tim White Date: Wed, 14 Feb 2024 16:20:38 +1100 Subject: [PATCH] Add comment when not authorized, ensure state is passed to createNewRepo job --- .github/templates/unauthorized-approval.md | 3 +++ .github/workflows/approve-label.yml | 11 ++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 .github/templates/unauthorized-approval.md diff --git a/.github/templates/unauthorized-approval.md b/.github/templates/unauthorized-approval.md new file mode 100644 index 0000000..1bc1fae --- /dev/null +++ b/.github/templates/unauthorized-approval.md @@ -0,0 +1,3 @@ +### Unauthorized Approval ❌ + +Only members of the @model_reviewers team are able to approve model submissions. \ No newline at end of file diff --git a/.github/workflows/approve-label.yml b/.github/workflows/approve-label.yml index ad7b033..4cf142b 100644 --- a/.github/workflows/approve-label.yml +++ b/.github/workflows/approve-label.yml @@ -72,6 +72,8 @@ jobs: createRepoAuthorization: if: contains(github.event.label.name, 'approved') runs-on: ubuntu-latest + outputs: + authorized: ${{ steps.verify_labeler.outputs.authorized }} steps: - name: Checkout uses: actions/checkout@v4 @@ -96,9 +98,16 @@ jobs: AUTHORIZED=$(python3 .github/scripts/approval_authorization.py) echo "authorized=${AUTHORIZED}" >> $GITHUB_OUTPUT + - name: comment if unauthorized + if: ${{ steps.verify_labeler.outputs.authorized }} == "False" + uses: GrantBirki/comment@v2.0.8 + with: + issue-number: ${{ github.event.issue.number }} + file: .github/templates/unauthoriszed-approval.md + createNewRepo: needs: createRepoAuthorization - if: ${{ needs.createRepoAuthorization.outputs.create_repo }} == "True" + if: ${{ needs.createRepoAuthorization.outputs.authorized }} == "True" runs-on: ubuntu-latest steps: - name: Checkout