|
25 | 25 | - run: npm run build |
26 | 26 |
|
27 | 27 | - name: Publish to npm with PR tag |
| 28 | + # Fork PRs have no access to NPM_TOKEN (secrets are withheld from |
| 29 | + # forks) — publishing would fail with ENEEDAUTH and kill the whole |
| 30 | + # job, so fork PRs skip npm but still get the tarball artifact + |
| 31 | + # comment below (#413; same fix as opencode-acp#366 / billion-context#670). |
| 32 | + if: ${{ github.event.pull_request.head.repo.full_name == github.repository }} |
28 | 33 | run: | |
29 | 34 | PR_NUMBER="${{ github.event.pull_request.number }}" |
30 | 35 | RUN_NUMBER="${{ github.run_number }}" |
@@ -58,27 +63,37 @@ jobs: |
58 | 63 | retention-days: 30 |
59 | 64 |
|
60 | 65 | - name: Comment on PR with install instructions |
| 66 | + # Fork PRs get a read-only GITHUB_TOKEN (same withholding policy as |
| 67 | + # secrets) — issues.createComment would 403 there, so don't let that |
| 68 | + # fail the otherwise-green fork build (#413). |
| 69 | + continue-on-error: true |
61 | 70 | uses: actions/github-script@v7 |
62 | 71 | with: |
63 | 72 | script: | |
64 | 73 | const prNumber = context.payload.pull_request.number; |
65 | 74 | const sha = context.payload.pull_request.head.sha.slice(0, 7); |
66 | 75 | const branch = context.payload.pull_request.head.ref; |
67 | 76 | const runUrl = `https://github.com/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`; |
| 77 | + const isFork = context.payload.pull_request.head.repo.full_name !== `${context.repo.owner}/${context.repo.repo}`; |
68 | 78 |
|
69 | 79 | const body = [ |
70 | 80 | '## 📦 Built Extension Artifact', |
71 | 81 | '', |
72 | 82 | `**Branch:** \`${branch}\` (${sha})`, |
73 | 83 | '', |
74 | | - '### Option A — Install from npm PR tag (recommended)', |
75 | | - '', |
76 | | - '```bash', |
77 | | - 'pi install npm:billion-context-pi@pr-' + prNumber, |
78 | | - '```', |
79 | | - '', |
80 | | - 'Each push to this PR publishes a new version under the `pr-' + prNumber + '` npm tag.', |
81 | | - '', |
| 84 | + ...(isFork ? [ |
| 85 | + '> ℹ️ This PR comes from a fork — npm PR-tag publishing is skipped (no registry credentials). Use the artifact below.', |
| 86 | + '', |
| 87 | + ] : [ |
| 88 | + '### Option A — Install from npm PR tag (recommended)', |
| 89 | + '', |
| 90 | + '```bash', |
| 91 | + 'pi install npm:billion-context-pi@pr-' + prNumber, |
| 92 | + '```', |
| 93 | + '', |
| 94 | + 'Each push to this PR publishes a new version under the `pr-' + prNumber + '` npm tag.', |
| 95 | + '', |
| 96 | + ]), |
82 | 97 | '### Option B — Download artifact', |
83 | 98 | '', |
84 | 99 | `1. Download the artifact from the [Actions run](${runUrl})`, |
|
0 commit comments