Skip to content
Merged
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: 15 additions & 7 deletions .github/workflows/major-version-updater.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,31 @@
name: Update major tag for release
on:
release:
types: [released]
types: [published]
workflow_dispatch:
inputs:
TAG_NAME:
description: "Tag name that the major tag will point to (e.g. v1.2.3)"
required: true
env:
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }}
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.ref}}
Copy link
Preview

Copilot AI Apr 4, 2025

Choose a reason for hiding this comment

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

Using github.ref as a fallback for TAG_NAME may lead to unexpected behavior if the reference is not a tag. Consider verifying that the fallback value is always a tag.

Suggested change
TAG_NAME: ${{ github.event.inputs.TAG_NAME || github.ref}}
TAG_NAME: ${{ github.event.inputs.TAG_NAME || (github.ref.startsWith('refs/tags/') && github.ref) || '' }}

Copilot uses AI. Check for mistakes.

permissions:
contents: write
jobs:
update_tag:
name: Update the major tag to include the ${{ github.event.inputs.TAG_NAME || github.event.release.tag_name }} changes
runs-on: ubuntu-latest
steps:
- name: Update the ${{ env.TAG_NAME }} tag
uses: actions/publish-action@8a4b4f687b72f481b8a241ef71f38857239698fc
with:
source-tag: ${{ env.TAG_NAME }}
token: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout Repo
uses: actions/[email protected]
- name: version
id: version
run: |
tag=${TAG_NAME/refs\/tags\//}
version=${tag#v}
major=${version%%.*}
{ echo "tag=${tag}"; echo "version=${version}"; echo "major=${major}"; } >> "$GITHUB_OUTPUT"
- name: force update major tag
run: |
git tag v${{ steps.version.outputs.major }}
git push origin refs/tags/v${{ steps.version.outputs.major }} -f
Loading