Skip to content

Commit

Permalink
action to rename tags has been added
Browse files Browse the repository at this point in the history
  • Loading branch information
Scott Alexander committed May 31, 2024
1 parent 8375c3e commit 92d4559
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/git-rename-tag.yml
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}}'
})

0 comments on commit 92d4559

Please sign in to comment.