Skip to content

Commit c10fe6b

Browse files
authored
Create workflow to fix commit message
This workflow amends the merge commit message and force pushes the updated commit to the main branch and the specified tag.
1 parent f181ef9 commit c10fe6b

1 file changed

Lines changed: 44 additions & 0 deletions

File tree

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Fix commit message
2+
3+
on:
4+
workflow_dispatch:
5+
6+
jobs:
7+
fix:
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
steps:
12+
- uses: actions/checkout@v4
13+
with:
14+
fetch-depth: 0
15+
16+
- name: Amend merge commit and force push
17+
env:
18+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
19+
run: |
20+
git config user.name "gustavofreze"
21+
git config user.email "gustavo.freze@gmail.com"
22+
23+
NEW_COMMIT=$(gh api repos/tiny-blocks/collection/git/commits \
24+
--method POST \
25+
-f "message=Release/2.3.0 (#44)" \
26+
-f "tree=588c2c34ed2f23b462c2a63921119e5b7dbe3cea" \
27+
-f "parents[]=9e810a807be46dfe5dc1402985283e342967a4bb" \
28+
--jq '.sha')
29+
30+
echo "New commit SHA: $NEW_COMMIT"
31+
32+
gh api repos/tiny-blocks/collection/git/refs/heads/main \
33+
--method PATCH \
34+
-f "sha=$NEW_COMMIT" \
35+
-F "force=true"
36+
37+
echo "Main branch updated"
38+
39+
gh api repos/tiny-blocks/collection/git/refs/tags/2.3.0 \
40+
--method PATCH \
41+
-f "sha=$NEW_COMMIT" \
42+
-F "force=true"
43+
44+
echo "Tag 2.3.0 updated"

0 commit comments

Comments
 (0)