Skip to content

Commit

Permalink
Fix autorelease workflow
Browse files Browse the repository at this point in the history
This was changed to appease a new linter but broke the code.

https://trello.com/c/TxQI9DMy/3542-fix-autorelease-workflow
  • Loading branch information
MuriloDalRi committed May 29, 2024
1 parent bf1942a commit 14c1854
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/autorelease-rubygem.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
id: fetch_default_branch_head
run: echo "sha=$(git ls-remote origin HEAD | cut -f 1)" >> "$GITHUB_OUTPUT"

- if: github.sha == steps.fetch_default_branch_head.outputs.sha
- if: github.sha != steps.fetch_default_branch_head.outputs.sha
name: "Auto-release rubygem"
env:
GEM_NAME: ${{ inputs.gem_name }}
Expand All @@ -38,9 +38,11 @@ jobs:
set -euo pipefail
curr_ver=$(ruby -r rubygems -e "puts Gem::Specification::load('$GEM_NAME.gemspec').version")
echo $curr_ver
IFS=. read -ra ver_parts <<< "$curr_ver"
(( ver_parts[2]++ )) # Increment the patch version.
next_ver=$(printf "%d.%d.%d" "${ver_parts[@]}")
next_ver=$(printf "%d.%d.%d" "${ver_parts[0]}" "${ver_parts[1]}" "${ver_parts[2]}")
echo $next_ver
branch="release-$next_ver"
pr_title="Release v$next_ver"
pr_desc="This is an automated PR to bump the version number to $next_ver. This is a patch-level bump, as the only changes since v$curr_ver are dependency updates made by Dependabot."
Expand Down Expand Up @@ -83,7 +85,7 @@ jobs:
gh pr create -H "$branch" --title "$pr_title" --body "$pr_desc"
- if: github.sha != steps.fetch_default_branch_head.outputs.sha
- if: github.sha == steps.fetch_default_branch_head.outputs.sha
name: "Skip release: commit is not HEAD of default branch"
run: |
echo "Skipping release because commit (${GITHUB_SHA}) isn't the HEAD of the default branch (${{ steps.fetch_default_branch_head.outputs.sha }})"

0 comments on commit 14c1854

Please sign in to comment.