-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
chore: pkg.pr.new preview with label and comment #18211
Merged
patak-dev
merged 6 commits into
vitejs:main
from
Aslemammad:fix/preview-with-label-and-comment
Oct 28, 2024
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,15 @@ | ||
name: Publish Any Commit | ||
|
||
env: | ||
# install playwright binary manually (because pnpm only runs install script once) | ||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" | ||
name: Add continuous release label | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
issue_comment: | ||
types: [created] | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
jobs: | ||
build: | ||
if: github.repository == 'vitejs/vite' && (github.event_name == 'push' || github.event.issue.pull_request && startsWith(github.event.comment.body, '/pkg-pr-new')) | ||
label: | ||
if: github.repository == 'vitejs/vite' && github.event.issue.pull_request && startsWith(github.event.comment.body, '/pkg-pr-new') | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
|
@@ -54,18 +50,7 @@ jobs: | |
}) | ||
throw new Error('not allowed') | ||
} | ||
|
||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install pnpm | ||
uses: pnpm/[email protected] | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Build | ||
working-directory: ./packages/vite | ||
run: pnpm build | ||
|
||
- run: pnpm dlx [email protected] publish --compact --pnpm ./packages/vite | ||
- run: | | ||
gh issue edit ${{ github.event.issue.number }} --add-label "pr: preview" --repo ${{ github.repository }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
name: Preview release | ||
|
||
env: | ||
# install playwright binary manually (because pnpm only runs install script once) | ||
PLAYWRIGHT_SKIP_BROWSER_DOWNLOAD: "1" | ||
|
||
permissions: | ||
pull-requests: write | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
types: [labeled] | ||
|
||
jobs: | ||
preview: | ||
if: > | ||
github.repository == 'vitejs/vite' && | ||
(github.event_name == 'push' || | ||
(github.event.issue.pull_request && contains(github.event.pull_request.labels.*.name, 'pr: preview'))) | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install pnpm | ||
uses: pnpm/[email protected] | ||
|
||
- name: Install dependencies | ||
run: pnpm install | ||
|
||
- name: Build | ||
working-directory: ./packages/vite | ||
run: pnpm build | ||
|
||
- run: pnpm dlx [email protected] publish --compact --pnpm ./packages/vite | ||
|
||
- if: github.event_name != 'push' | ||
run: | | ||
gh issue edit ${{ github.event.issue.number }} --remove-label "pr: preview" --repo ${{ github.repository }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Might this have an issue with the default token limitation @userquin was mentioning in vitest-dev/vitest#6362 (comment)?
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.
Hmm, interesting, didn't know that! isn't there any workaround to this?
because adding custom tokens might not feel that good!
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.
If there's no solution, maybe we can go with the manual label addition!
cc @patak-dev
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.
Ya, I think the Vitest setup may work well for Vite too.
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.
You can use a bot, check vitepress, ask @brc-dd
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.
just made the change!
"trigger: preview" would cause a publish. Then that label would be removed for next time runs, so they'd be caused by adding the same label again.