Skip to content

Commit

Permalink
chore: use actions-cool/check-user-permission for permissions check
Browse files Browse the repository at this point in the history
  • Loading branch information
kettanaito committed Oct 27, 2024
1 parent 87e711a commit 0eda488
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,27 @@ on:
workflow_dispatch:

jobs:
check:
# Check the user approving this pull request.
# They must have the write access to the repo
# to trigger the preview publish.
if: github.event.review.state == 'approved'
runs-on: ubuntu-latest
steps:
- name: Check permissions
id: checkPermissions
uses: actions-cool/check-user-permission@v2
with:
username: github.triggering_actor
require: 'write'

- if: steps.checkPermissions.outputs.check-result == 'false'
run: exit 1

preview:
# Publish previews only for approved pull requests.
# The reviewer must have push persmissions to trigger this job.
if: github.event.review.state == 'approved' && github.event.review.user.permissions.push == true
# The approving user must pass the permissions check
# to trigger the preview publish.
needs: check
runs-on: macos-latest
steps:
- name: Checkout
Expand Down

0 comments on commit 0eda488

Please sign in to comment.