Skip to content

Commit c23679d

Browse files
Create issue-template-number.yml
issue number auto append in issue title
1 parent 4f4bf4f commit c23679d

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: "Auto Replace X in Issue Title"
2+
3+
on:
4+
issues:
5+
types: [opened]
6+
7+
jobs:
8+
update_issue_title:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Replace 'X' with issue number
12+
env:
13+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14+
run: |
15+
ISSUE_NUMBER=${{ github.event.issue.number }}
16+
OLD_TITLE="${{ github.event.issue.title }}"
17+
18+
# Replace 'X' with the actual issue number in the title
19+
NEW_TITLE=$(echo "$OLD_TITLE" | sed "s/X/$ISSUE_NUMBER/g")
20+
21+
# Update issue title using GitHub API
22+
curl -X PATCH -H "Authorization: token $GITHUB_TOKEN" \
23+
-H "Accept: application/vnd.github.v3+json" \
24+
https://api.github.com/repos/${{ github.repository }}/issues/${ISSUE_NUMBER} \
25+
-d "{\"title\": \"${NEW_TITLE}\"}"

0 commit comments

Comments
 (0)