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
30 changes: 29 additions & 1 deletion .github/workflows/update-major-tag.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,41 @@ jobs:
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.release.tag_name }}
fetch-depth: 0

- name: Update major version tag
- uses: pnpm/action-setup@v4
- uses: actions/setup-node@v4
with:
node-version: '24'
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build action bundle
run: pnpm build:action

- name: Commit bundle and update tags
run: |
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The workflow uses $GITHUB_REF_NAME to create a release tag, but this variable is not reliably populated for release triggers, which could lead to incorrect tagging.
Severity: HIGH

Suggested Fix

Replace the usage of $GITHUB_REF_NAME in the bash script with ${{ github.event.release.tag_name }}. This can be achieved by passing it as an environment variable to the step before it is used, for example: env: RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}, and then using $RELEASE_TAG_NAME in the script.

Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.

Location: .github/workflows/update-major-tag.yml#L32

Potential issue: In the `update-major-tag.yml` workflow, a script uses the
`$GITHUB_REF_NAME` environment variable to derive the version for creating a new git
tag. However, for workflows triggered by a `release` event, `GITHUB_REF_NAME` is not
guaranteed to be populated and may be empty. This will cause the script to attempt to
create a tag named `v`, which will either fail or corrupt the release tagging process.
This would break the GitHub Action for that release version. An earlier step in the same
workflow correctly uses `github.event.release.tag_name`, indicating this is likely an
oversight.

VERSION="${GITHUB_REF_NAME#v}"
MAJOR="v${VERSION%%.*}"

git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"

# Stage only the bundle files needed by the action
git add -f dist/action/index.js dist/action/licenses.txt dist/action/package.json
# Add chunk files if ncc produced any (code-split dynamic imports)
git add -f dist/action/*.index.js 2>/dev/null || true

# Skip commit if bundle is already present (idempotent re-runs)
git diff --cached --quiet || git commit -m "Build dist/action for $GITHUB_REF_NAME"

# Update version tag to include the bundle
git tag -fa "$GITHUB_REF_NAME" -m "Release $GITHUB_REF_NAME"
git push -f origin "$GITHUB_REF_NAME"

# Update major version tag
git tag -fa "$MAJOR" -m "Update $MAJOR to $GITHUB_REF_NAME"
git push -f origin "$MAJOR"
13 changes: 2 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,8 @@
# Dependencies
node_modules/

# Build output (only dist/action/ ncc bundle is committed)
dist/*
!dist/action/

# Only ncc bundle files in dist/action/
dist/action/*
!dist/action/index.js
!dist/action/*.index.js
!dist/action/licenses.txt
!dist/action/sourcemap-register.cjs
!dist/action/package.json
# Build output
dist/

# IDE
.idea/
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export { SkillReport, runSkill } from "./types/index.js";

## Build & Dist

Only the `dist/action/` ncc bundle is checked into the repo (for the GitHub Action). All other tsc output in `dist/` is gitignored. Run `pnpm build:action` and commit `dist/action/` when action source changes.
All of `dist/` is gitignored. The ncc action bundle (`dist/action/`) is built and committed to release tags only by the `update-major-tag` workflow. Never commit build artifacts to main.

## Verifying Changes

Expand Down
3 changes: 0 additions & 3 deletions bin/bump-version.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,5 @@ NEW_VERSION="${2}"
export npm_config_git_tag_version=false
npm version "${NEW_VERSION}"

# Build for npm and GitHub Action (dist/action must be committed with release)
pnpm install --frozen-lockfile
pnpm build
pnpm build:action
git add -f dist/action/
Loading