-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: split check-pr workflow into 3 workflows
For the "Bundle Impact" section of a PR to be updated by GitHub actions, the workflow must be triggered with the `pull_request_target` event. For security, keep using the `pull_request` event for linting and testing of PRs.
- Loading branch information
1 parent
be83144
commit 24307ef
Showing
3 changed files
with
54 additions
and
29 deletions.
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 |
---|---|---|
@@ -0,0 +1,30 @@ | ||
name: Bundle Impact | ||
|
||
on: | ||
pull_request_target: | ||
branches: [main, next] | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
bundle-impact: | ||
name: Calculate Bundle Impact | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v4 | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '22.x' | ||
cache: pnpm | ||
- run: pnpm install | ||
- name: Run Bundle Impact | ||
uses: actions/github-script@v7 | ||
with: | ||
github-token: ${{secrets.GITHUB_TOKEN}} | ||
script: | | ||
console.log(process.env) | ||
delete process.env.GITHUB_TOKEN | ||
const script = require('./scripts/pr-bundle-impact.cjs') | ||
await script.run({github, core, context}) |
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 |
---|---|---|
|
@@ -6,23 +6,6 @@ on: | |
types: [opened, synchronize, reopened, edited] | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x, 20.x, 22.x] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: pnpm | ||
- run: pnpm install | ||
- run: pnpm test | ||
|
||
validate: | ||
name: Validate | ||
runs-on: ubuntu-latest | ||
|
@@ -40,18 +23,6 @@ jobs: | |
- run: pnpm install | ||
- run: pnpm install @commitlint/[email protected] | ||
|
||
- name: Refresh Bundle Impact | ||
uses: actions/github-script@v6 | ||
if: ${{ github.head_ref != 'next' }} | ||
continue-on-error: true | ||
env: | ||
TARGET_BRANCH: ${{ github.event.pull_request.base.ref }} | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
const { run } = require('./scripts/pr-bundle-impact.cjs'); | ||
run({ github, core, context }); | ||
- name: Lint | ||
run: pnpm lint | ||
|
||
|
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,24 @@ | ||
name: Test Pull Request | ||
|
||
on: | ||
pull_request: | ||
branches: [main, next] | ||
types: [opened, synchronize] | ||
|
||
jobs: | ||
test: | ||
name: Test | ||
runs-on: ubuntu-latest | ||
strategy: | ||
matrix: | ||
node-version: [18.x, 20.x, 22.x] | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: pnpm/action-setup@v4 | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
cache: pnpm | ||
- run: pnpm install | ||
- run: pnpm test |