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 50edf37
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions .github/workflows/release-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,26 @@ on:
workflow_dispatch:

jobs:
check:
# Trigger the permissions check whenever someone approves a pull request.
# They must have the write permissions to the repo in order to
# trigger preview package publishing.
if: github.event.review.state == 'approved'
runs-on: ubuntu-latest
outputs:
has-permissions: ${{ steps.checkPermissions.outputs.require-result }}
steps:
- name: Check permissions
id: checkPermissions
uses: actions-cool/check-user-permission@v2
with:
require: 'write'

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
if: needs.check.outputs.has-permissions == 'true'
runs-on: macos-latest
steps:
- name: Checkout
Expand Down

0 comments on commit 50edf37

Please sign in to comment.