Repository navigation
fix: release workflow — use github.token and handle first release #515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -29,7 +29,7 @@ jobs: | |||||||||||||||||||||||||||||||||||
| - name: Check if release already exists | ||||||||||||||||||||||||||||||||||||
| id: exists | ||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }} | ||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ github.token }} | ||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||
| TAG="v${{ steps.pkg.outputs.version }}" | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
|
|
@@ -44,7 +44,7 @@ jobs: | |||||||||||||||||||||||||||||||||||
| id: prev | ||||||||||||||||||||||||||||||||||||
| if: steps.exists.outputs.skip != 'true' | ||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }} | ||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ github.token }} | ||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||
| TAG="v${{ steps.pkg.outputs.version }}" | ||||||||||||||||||||||||||||||||||||
| PREV=$(gh release list --limit 50 --json tagName -q '.[].tagName' | grep -v "^${TAG}$" | head -1) | ||||||||||||||||||||||||||||||||||||
|
|
@@ -54,21 +54,24 @@ jobs: | |||||||||||||||||||||||||||||||||||
| - name: Generate changelog | ||||||||||||||||||||||||||||||||||||
| uses: orhun/git-cliff-action@v4 | ||||||||||||||||||||||||||||||||||||
| id: cliff | ||||||||||||||||||||||||||||||||||||
| if: steps.exists.outputs.skip != 'true' | ||||||||||||||||||||||||||||||||||||
| if: steps.exists.outputs.skip != 'true' && steps.prev.outputs.tag != '' | ||||||||||||||||||||||||||||||||||||
| with: | ||||||||||||||||||||||||||||||||||||
| config: cliff.toml | ||||||||||||||||||||||||||||||||||||
| args: ${{ steps.prev.outputs.tag && format('{0}..HEAD', steps.prev.outputs.tag) || 'HEAD~20..HEAD' }} | ||||||||||||||||||||||||||||||||||||
| args: ${{ format('{0}..HEAD', steps.prev.outputs.tag) }} | ||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||
| GITHUB_REPO: ${{ github.repository }} | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
| - name: Create release | ||||||||||||||||||||||||||||||||||||
| if: steps.exists.outputs.skip != 'true' | ||||||||||||||||||||||||||||||||||||
| env: | ||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ secrets.RELEASE_PLEASE_TOKEN }} | ||||||||||||||||||||||||||||||||||||
| RELEASE_NOTES: ${{ steps.cliff.outputs.content }} | ||||||||||||||||||||||||||||||||||||
| GH_TOKEN: ${{ github.token }} | ||||||||||||||||||||||||||||||||||||
| run: | | ||||||||||||||||||||||||||||||||||||
| TAG="v${{ steps.pkg.outputs.version }}" | ||||||||||||||||||||||||||||||||||||
| printf '%s' "$RELEASE_NOTES" > /tmp/release-notes.md | ||||||||||||||||||||||||||||||||||||
| NOTES="${{ steps.cliff.outputs.content }}" | ||||||||||||||||||||||||||||||||||||
| if [ -z "$NOTES" ]; then | ||||||||||||||||||||||||||||||||||||
| NOTES="Initial release of genie v3 CLI." | ||||||||||||||||||||||||||||||||||||
| fi | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+71
to
+73
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fallback message may be misleading on subsequent releases. If git-cliff runs (previous tag exists) but produces empty output—e.g., only merge commits or non-conventional messages—the fallback claims "Initial release of genie v3 CLI." which would be incorrect for a non-initial release. Consider a more generic fallback like 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| printf '%s' "$NOTES" > /tmp/release-notes.md | ||||||||||||||||||||||||||||||||||||
|
Comment on lines
+70
to
+74
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shell injection risk: avoid direct interpolation of multi-line content.
Proposed fix - name: Create release
if: steps.exists.outputs.skip != 'true'
env:
GH_TOKEN: ${{ github.token }}
+ CLIFF_NOTES: ${{ steps.cliff.outputs.content }}
run: |
TAG="v${{ steps.pkg.outputs.version }}"
- NOTES="${{ steps.cliff.outputs.content }}"
+ NOTES="${CLIFF_NOTES}"
if [ -z "$NOTES" ]; then
NOTES="Initial release of genie v3 CLI."
fi
printf '%s' "$NOTES" > /tmp/release-notes.md📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||
| gh release create "${TAG}" \ | ||||||||||||||||||||||||||||||||||||
| --target "${{ github.sha }}" \ | ||||||||||||||||||||||||||||||||||||
| --title "${TAG}" \ | ||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
Create releasestep now inlinessteps.cliff.outputs.contentintoNOTES="...", which means GitHub expression expansion happens before Bash parsing; if the changelog contains characters like", backticks, or$()(common in commit subjects/body text), the script can break or perform command substitution, causing release jobs to fail unpredictably. This regression is introduced by moving from an env var to direct inline assignment, so release notes should be passed in a way that bypasses shell parsing.Useful? React with 👍 / 👎.