-
Notifications
You must be signed in to change notification settings - Fork 55
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Approval-based example allows publishing by anybody #267
Comments
I can confirm that any approval of a PR triggers preview publishing (see mswjs/msw#2335, the approval from @dandelionadia). This isn't an issue of this library, but a better setup would be appreciated in the README. The one listed is not secure. Anybody can trigger the preview publish, which defies the whole purpose of locking it behind the approval state. |
I've looked everywhere, but there doesn't seem to be a way to check the PR reviewer's permissions in the |
SolutionAfter hours of research, this is finally the approach that worked for me: name: release
on:
pull_request_review:
types: [submitted]
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:
# 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
uses: actions/checkout@v4
# Prepare your package here...
- name: Publish preview
run: # RELEASE COMMAND HERE This has two jobs so
|
Vite has a similar process to check the permissions. you can also use |
@AmirSa12 Can we add what Artem and you are suggesting to the recipes, i love both of the solutions! |
@AmirSa12, nice one if you base your publishing around comments. I really like the approval-based publishing, Vite's setup is a bit too complex for my liking. @Aslemammad, I'm more than happy to open a PR if you find these approaches suitable! I believe the one featured in the README right now doesn't quite do what it's supposed to do. |
💯 feel free to send a pr! excited to see it! |
Opened a pull request at #269. Let me know what you think. |
Hi! Thanks for an awesome tool.
A quick question: does the approval-based publishing kick in if anybody approves a pull request? This is probably a question more to GitHub Actions, but I thought you'd know.
My concern is that I want to automatically publish the package only if a team member approved it. So that random user couldn't approve potentially malicious changes.
The text was updated successfully, but these errors were encountered: