diff --git a/.github/workflows/update_galata_references.yaml b/.github/workflows/update_galata_references.yaml index 50b20a88f..89db36ab1 100644 --- a/.github/workflows/update_galata_references.yaml +++ b/.github/workflows/update_galata_references.yaml @@ -20,32 +20,9 @@ jobs: if: github.event.issue.pull_request && contains(github.event.comment.body, 'please update snapshots') steps: - - name: Get commenter association - id: association - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - association=$(gh api \ - repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }} \ - --jq '.author_association') - - echo "association=$association" >> $GITHUB_OUTPUT - - - name: Fail if user is not authorized - if: | - !contains(fromJSON('["OWNER","COLLABORATOR","MEMBER"]'), steps.association.outputs.association) - run: | - gh api repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions --raw-field 'content=-1' - echo "User not authorized to update snapshots" - exit 1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: React positively to the triggering comment - run: | - gh api repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions --raw-field 'content=+1' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: martinRenou/maintainer-tools/.github/actions/update-snapshots-check-permission@check_perm + with: + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Checkout uses: actions/checkout@v6 diff --git a/.github/workflows/update_lite_galata_references.yaml b/.github/workflows/update_lite_galata_references.yaml index 227a46f6a..724754ef0 100644 --- a/.github/workflows/update_lite_galata_references.yaml +++ b/.github/workflows/update_lite_galata_references.yaml @@ -20,30 +20,9 @@ jobs: if: github.event.issue.pull_request && contains(github.event.comment.body, 'please update snapshots') steps: - - name: Get commenter association - id: association - env: - GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - association=$(gh api \ - repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }} \ - --jq '.author_association') - - echo "association=$association" >> $GITHUB_OUTPUT - - - name: Fail if user is not authorized - if: | - !contains(fromJSON('["OWNER","COLLABORATOR","MEMBER"]'), steps.association.outputs.association) - run: | - echo "User not authorized to update snapshots" - exit 1 - - steps: - - name: React to the triggering comment - run: | - gh api repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions --raw-field 'content=+1' - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - uses: martinRenou/maintainer-tools/.github/actions/update-snapshots-check-permission@check_perm + with: + github_token: ${{ secrets.GITHUB_TOKEN }} - name: Checkout uses: actions/checkout@v6