mirror of
https://github.com/ivuorinen/actions.git
synced 2026-01-26 03:23:59 +00:00
fix: add tag existence check to version-maintenance workflow (#425)
* fix: add tag existence check to version-maintenance workflow Prevents workflow failure when major version tag doesn't exist by checking for and creating the tag before running action-versioning. * fix: add git config for tag creation in version-maintenance workflow GitHub Actions runners don't have default git user configuration, which causes annotated tag creation to fail. Add user.name and user.email config before creating tags.
This commit is contained in:
23
.github/workflows/version-maintenance.yml
vendored
23
.github/workflows/version-maintenance.yml
vendored
@@ -40,6 +40,29 @@ jobs:
|
||||
printf '%s\n' "major=v$current_year" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Ensure Major Version Tag Exists
|
||||
id: ensure-tag
|
||||
shell: sh
|
||||
env:
|
||||
MAJOR_VERSION: ${{ steps.version.outputs.major }}
|
||||
run: |
|
||||
set -eu
|
||||
|
||||
git fetch --tags --force
|
||||
|
||||
if git rev-list -n 1 "$MAJOR_VERSION" >/dev/null 2>&1; then
|
||||
echo "Tag $MAJOR_VERSION already exists"
|
||||
printf '%s\n' "created=false" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo "Tag $MAJOR_VERSION not found, creating..."
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git tag -a "$MAJOR_VERSION" -m "Major version $MAJOR_VERSION"
|
||||
git push origin "$MAJOR_VERSION"
|
||||
echo "Created and pushed tag $MAJOR_VERSION"
|
||||
printf '%s\n' "created=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
- name: Run Action Versioning
|
||||
id: action-versioning
|
||||
uses: ./action-versioning
|
||||
|
||||
Reference in New Issue
Block a user