-
-
Notifications
You must be signed in to change notification settings - Fork 232
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
ci: add pkg.pr.new GitHub action workflow #931
Conversation
@zernonia why not update to latest pnpm? GitHub workflow files are outdated one uses node 16 one uses 18 😕 |
Chat GPT4o response xd
To configure GitHub Actions to run on
Step 1: Main WorkflowCreate a workflow file name: Main Workflow
on:
push:
pull_request:
pull_request_review:
types: [submitted]
jobs:
check-approval:
runs-on: ubuntu-latest
steps:
- name: Check if PR is approved
id: check_pr_approved
uses: actions/github-script@v6
with:
script: |
const { data: reviews } = await github.pulls.listReviews({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.payload.pull_request.number,
});
const approved = reviews.some(review => review.state === 'approved');
core.setOutput('approved', approved);
trigger-secondary-workflow:
needs: check-approval
if: steps.check_pr_approved.outputs.approved == 'true'
runs-on: ubuntu-latest
steps:
- name: Trigger secondary workflow
uses: benc-uk/workflow-dispatch@v1
with:
workflow: 'Secondary Workflow'
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.ref }} Step 2: Secondary WorkflowCreate another workflow file name: Secondary Workflow
on:
workflow_run:
workflows: ["Main Workflow"]
types:
- completed
jobs:
run-actions:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Run your actions
run: |
echo "Running actions on approved PR"
# Add your actual actions/commands here Explanation
By structuring the workflows this way, you ensure that actions are only run if the pull request is approved, meeting your specified conditions. |
cc @Aslemammad 🙏 Thanks for this tool this will help maintainers ❤️ |
Thank you team for using https://pkg.pr.new! It means a lot to us. |
Hahahaha no reason. Just didnt have the need to update because the pipeline we have is working now. If this new addition requires higher version of node, sure let's upgrade it! |
@sadeghbarati It's being triggered here Seems like the publishing work. However it would be nice to have the App to comment the npm command. cc @Aslemammad npm i https://pkg.pr.new/radix-vue/radix-vue@2de584a |
pull_request_review: | ||
types: [submitted] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think publishing this also can be trigger only when there's change in packages
, similar to build.yaml
workflow
pull_request_review:
types: [submitted]
paths:
- 'packages/**'
|
You need to configure pkg.pr.new GitHub app first
https://github.com/stackblitz-labs/pkg.pr.new
I need some help here cause I have zero experience in advanced GitHub actions
based on workflow file I want to run
pkg.pr.new
action onOne more thing about
packages/plugins
,how to check this path if it's changed then run build all packages
in another word, if the user push 100 commits workflow doesn't run
until someone approved the PR
after that any other (push, synchronize, reopened) allowed to trigger the workflow job