-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
action to rename tags has been added
- Loading branch information
Scott Alexander
committed
May 31, 2024
1 parent
8375c3e
commit 92d4559
Showing
1 changed file
with
52 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: 'Git - Rename Tag' | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
old_tag: | ||
description: 'Numerical only e.g. 1.0.0' | ||
required: true | ||
type: 'string' | ||
new_tag: | ||
description: 'Numerical only e.g. 1.1.0' | ||
required: true | ||
type: 'string' | ||
|
||
permissions: | ||
pull-requests: write | ||
id-token: write # This is required for requesting the JWT | ||
contents: write # This is required for actions/checkout | ||
|
||
jobs: | ||
tag_renaming_process: | ||
runs-on: ubuntu-latest | ||
permissions: write-all | ||
|
||
steps: | ||
|
||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: ${{ github.event.inputs.old_tag }} | ||
fetch-depth: 0 | ||
|
||
- name: Check SHA | ||
id: get-sha | ||
run: | | ||
echo "BRANCH_SHA=$(git log -1 '--format=format:%H')">> $GITHUB_OUTPUT | ||
- name: Check SHA value | ||
run: | | ||
echo Branch SHA: ${{steps.get-sha.outputs.BRANCH_SHA}} | ||
- name: Create tag | ||
uses: actions/github-script@v7 | ||
with: | ||
script: | | ||
console.log(context) | ||
github.rest.git.createRef({ | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
ref: 'refs/tags/${{github.event.inputs.new_tag}}', | ||
sha:'${{steps.get-sha.outputs.BRANCH_SHA}}' | ||
}) |