diff --git a/.github/actions/permission-check.yaml b/.github/actions/permission-check.yaml new file mode 100644 index 0000000..41ab7d8 --- /dev/null +++ b/.github/actions/permission-check.yaml @@ -0,0 +1,16 @@ +steps: + - name: Get User Permission + id: checkAccess + uses: actions-cool/check-user-permission@v2 + with: + require: write + username: ${{ github.triggering_actor }} + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Check User Permission + if: steps.checkAccess.outputs.require-result == 'false' + run: | + echo "${{ github.triggering_actor }} does not have permissions on this repo." + echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}" + echo "Job originally triggered by ${{ github.actor }}" + exit 1 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index ce2e1d8..c775c2b 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -11,24 +11,10 @@ jobs: runs-on: ubuntu-latest steps: - - name: Get User Permission - id: checkAccess - uses: actions-cool/check-user-permission@v2 - with: - require: write - username: ${{ github.triggering_actor }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Check User Permission - if: steps.checkAccess.outputs.require-result == 'false' - run: | - echo "${{ github.triggering_actor }} does not have permissions on this repo." - echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}" - echo "Job originally triggered by ${{ github.actor }}" - exit 1 - uses: actions/checkout@v4 with: submodules: 'true' + - uses: ./.github/actions/permission-check - name: GCloud auth uses: 'google-github-actions/auth@v2' with: