Skip to content

Commit 4406915

Browse files
committed
ci: surface pkg-pr-new main install info in run summary
1 parent 3d73eba commit 4406915

File tree

1 file changed

+28
-1
lines changed

1 file changed

+28
-1
lines changed

.github/workflows/ci.yml

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,32 @@ jobs:
5252
run: npx pkg-pr-new publish --comment=update
5353

5454
- name: Publish preview package for main
55+
id: pkg_pr_new_main
5556
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
56-
run: npx pkg-pr-new publish --comment=off
57+
run: |
58+
set -euo pipefail
59+
npx pkg-pr-new publish --comment=off --json=pkg-pr-new-main.json
60+
61+
- name: Summarize pkg.new output for main
62+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && always()
63+
run: |
64+
{
65+
echo "## pkg.new preview for main"
66+
echo
67+
if [ -f pkg-pr-new-main.json ]; then
68+
echo "Install commands and preview links:"
69+
echo '```text'
70+
jq -r '.. | strings | select(test("pkg\\.pr\\.new|pkg\\.new|npm (i|install) "))' pkg-pr-new-main.json | sort -u
71+
echo '```'
72+
else
73+
echo "No pkg.new JSON output file was produced."
74+
fi
75+
} >> "$GITHUB_STEP_SUMMARY"
76+
77+
- name: Upload pkg.new metadata for main
78+
if: github.event_name == 'push' && github.ref == 'refs/heads/main' && always()
79+
uses: actions/upload-artifact@v4
80+
with:
81+
name: pkg-pr-new-main-${{ github.sha }}
82+
path: pkg-pr-new-main.json
83+
if-no-files-found: warn

0 commit comments

Comments
 (0)