Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .github/workflows/package-size-comment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ jobs:
&& pullRequest.base.repo.full_name === expectedBaseRepository,
)

if (matches.length === 0) {
core.info('The pull request closed or its head changed. Skipping the size comment.')
return
}

if (matches.length !== 1) {
core.setFailed(`Expected one open pull request for ${run.head_sha}, found ${matches.length}`)
return
Expand All @@ -78,6 +83,7 @@ jobs:
core.setOutput('number', matches[0].number)

- name: Download package size report
if: steps.pull-request.outputs.number != ''
uses: actions/download-artifact@v8
with:
name: package-size-report
Expand All @@ -88,6 +94,7 @@ jobs:
# The artifact comes from a workflow run that may be a fork pull request.
# Treat it as untrusted input and check it before it becomes a comment.
- name: Validate package size report
if: steps.pull-request.outputs.number != ''
env:
COMMENT_PATH: ${{ runner.temp }}/package-size-comment.md
EXPECTED_HEAD_SHA: ${{ github.event.workflow_run.head_sha }}
Expand Down Expand Up @@ -140,6 +147,7 @@ jobs:
sed 's/@/@<!-- -->/g' "$report" > "$COMMENT_PATH"

- name: Post comment on pull request
if: steps.pull-request.outputs.number != ''
uses: actions/github-script@v9
env:
COMMENT_PATH: ${{ runner.temp }}/package-size-comment.md
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,14 @@ jobs:

- name: Plan release
id: plan
run: node scripts/prepare-release.ts
run: |
# CI started before this workflow existed can finish after its merge.
if [ "$GITHUB_EVENT_NAME" = 'workflow_run' ] && [ ! -f scripts/prepare-release.ts ]; then
echo 'Skip CI for a commit that predates release automation.'
echo 'release=false' >> "$GITHUB_OUTPUT"
else
node scripts/prepare-release.ts
fi

release:
needs: prepare
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-release-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ if (!distTag || !output)
const names = ['@nuxt/scripts', '@nuxt/scripts-cli', '@nuxt/scripts-devtools']
const currentVersions = await Promise.all(names.map(async (name) => {
const response = await fetch(`https://registry.npmjs.org/${encodeURIComponent(name)}`, {
headers: { accept: 'application/vnd.npm.install-v1+json', 'cache-control': 'no-cache' },
headers: { 'accept': 'application/vnd.npm.install-v1+json', 'cache-control': 'no-cache' },
signal: AbortSignal.timeout(30000),
})
if (!response.ok)
Expand Down
Loading