Repository navigation
ci: add dry-run gate to npm release workflow - #46061
Conversation
Greptile SummaryThis PR refactors the npm release workflow into two distinct jobs: a lightweight Key changes:
Issues found:
Confidence Score: 3/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: .github/workflows/openclaw-npm-release.yml
Line: 27-29
Comment:
**Unnecessary `id-token: write` on preview job**
The `preview_openclaw_npm` job never calls `npm publish --provenance` and never requests an OIDC token, so `id-token: write` is not needed here. Granting it violates the principle of least privilege and unnecessarily exposes an OIDC token to every step in the job (including third-party actions like `setup-node-env`). The `id-token: write` permission should be kept only on the `publish_openclaw_npm` job.
```suggestion
permissions:
contents: read
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: .github/workflows/openclaw-npm-release.yml
Line: 105-107
Comment:
**Unvalidated tag input used in `ref:` field**
`inputs.tag` is interpolated directly into `ref: refs/tags/${{ inputs.tag }}` without first validating that it looks like a real version tag. A user with workflow-dispatch access (or who bypasses environment approval) could supply a value like `../heads/main`, which Git would resolve to `refs/heads/main`, causing the publish job to check out and publish from the tip of `main` rather than a reviewed, tagged commit.
Consider validating the tag format before the checkout, for example:
```yaml
- name: Validate tag input format
run: |
if [[ ! "${{ inputs.tag }}" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.]+)?$ ]]; then
echo "Invalid tag format: ${{ inputs.tag }}"
exit 1
fi
- name: Checkout
uses: actions/checkout@v6
with:
ref: refs/tags/${{ inputs.tag }}
fetch-depth: 0
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: .github/workflows/openclaw-npm-release.yml
Line: 44-55
Comment:
**Duplicate `--dry-run` invocation**
`bash scripts/openclaw-npm-publish.sh --dry-run` is called twice in the preview job — once here in "Print release plan" and again at line 92 in "Preview publish command". The script output is identical both times (it just prints the resolved `npm publish` command), so the second call is redundant and adds noise to the job log.
Consider removing the call from "Print release plan" and keeping only the dedicated "Preview publish command" step, or merging the two steps into one.
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: a688900 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c67db420a2
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
TL;DR
I wanna convert this to a dry run. In the first run, instead of publishing, it should just show the operations it will do, fully with all arguments.
Summary
npm-releaseenvironmentnpm publishcommandReview focus
refs/tags/<input>is the right publish targetTest plan
bash -n scripts/openclaw-npm-publish.shbash scripts/openclaw-npm-publish.sh --dry-runv*tag and confirm the workflow previews without publishingnpm-releaseapproval is required before publish