Skip to content

Commit 92d4559

Browse files
author
Scott Alexander
committed
action to rename tags has been added
1 parent 8375c3e commit 92d4559

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: 'Git - Rename Tag'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
old_tag:
7+
description: 'Numerical only e.g. 1.0.0'
8+
required: true
9+
type: 'string'
10+
new_tag:
11+
description: 'Numerical only e.g. 1.1.0'
12+
required: true
13+
type: 'string'
14+
15+
permissions:
16+
pull-requests: write
17+
id-token: write # This is required for requesting the JWT
18+
contents: write # This is required for actions/checkout
19+
20+
jobs:
21+
tag_renaming_process:
22+
runs-on: ubuntu-latest
23+
permissions: write-all
24+
25+
steps:
26+
27+
- name: Checkout
28+
uses: actions/checkout@v3
29+
with:
30+
ref: ${{ github.event.inputs.old_tag }}
31+
fetch-depth: 0
32+
33+
- name: Check SHA
34+
id: get-sha
35+
run: |
36+
echo "BRANCH_SHA=$(git log -1 '--format=format:%H')">> $GITHUB_OUTPUT
37+
38+
- name: Check SHA value
39+
run: |
40+
echo Branch SHA: ${{steps.get-sha.outputs.BRANCH_SHA}}
41+
42+
- name: Create tag
43+
uses: actions/github-script@v7
44+
with:
45+
script: |
46+
console.log(context)
47+
github.rest.git.createRef({
48+
owner: context.repo.owner,
49+
repo: context.repo.repo,
50+
ref: 'refs/tags/${{github.event.inputs.new_tag}}',
51+
sha:'${{steps.get-sha.outputs.BRANCH_SHA}}'
52+
})

0 commit comments

Comments
 (0)