Skip to content
Closed
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
22 changes: 14 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,29 @@ jobs:

steps:
- uses: actions/checkout@v6
with:
persist-credentials: false

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: "3.4"
bundler-cache: true

- name: Verify tag matches gem version
- name: Set gem version from tag
run: |
tag="${GITHUB_REF#refs/tags/v}"
version=$(ruby -r ./lib/customerio/version -e "puts Customerio::VERSION")
if [ "$tag" != "$version" ]; then
echo "::error::Tag v$tag does not match Customerio::VERSION ($version)"
exit 1
fi
sed -i "s/VERSION = \".*\"/VERSION = \"$tag\"/" lib/customerio/version.rb
echo "Version set to $tag"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Uncommitted sed change fails rake release guard_clean check

High Severity

The sed command modifies lib/customerio/version.rb without committing it, leaving a dirty working directory. The subsequent rubygems/release-gem@v1 step runs bundle exec rake release, which invokes Bundler's guard_clean check. This check detects the uncommitted change and aborts, completely preventing gem publication. The project's Rakefile uses standard bundler/gem_tasks with no override of this behavior.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a6d62d6. Configure here.


- name: Publish to RubyGems
uses: rubygems/release-gem@v1

- name: Update version on main
run: |
tag="${GITHUB_REF#refs/tags/v}"
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git checkout main

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Shallow clone prevents checkout of main branch

High Severity

git checkout main will fail because actions/checkout@v6 with the default fetch-depth: 1 only fetches the single commit for the tag that triggered the workflow. The main branch and its remote tracking ref origin/main are not available in the shallow clone. The checkout step needs either fetch-depth: 0 or an explicit git fetch origin main before switching branches.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit a6d62d6. Configure here.

sed -i "s/VERSION = \".*\"/VERSION = \"$tag\"/" lib/customerio/version.rb
git add lib/customerio/version.rb
git commit -m "Bump version to $tag [skip ci]"
git push origin main