-
Notifications
You must be signed in to change notification settings - Fork 2
92 lines (84 loc) · 2.58 KB
/
dev.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
name: Dev
on:
push:
branches: [ dev ]
release:
types: [ published ]
workflow_dispatch:
jobs:
build:
name: Build & Test
uses: ./.github/workflows/_test.yml
secrets: inherit
permissions:
pull-requests: write
contents: read
issues: read
checks: write
todos:
name: Convert Todos to Issues
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'push'
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: "TODO to Issue"
uses: "alstr/todo-to-issue-action@53d8a86de9f2224b24c6a9009a8a1f56d4e1324d" # v5
with:
INSERT_ISSUE_URLS: true
AUTO_ASSIGN: true
CLOSE_ISSUES: true
- name: Set Git user
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Commit and Push Changes
run: |
git add -A
if [[ `git status --porcelain` ]]; then
git commit -m "Automatically added GitHub issue links to TODOs"
git push origin main
else
echo "No changes to commit"
fi
release:
name: Push to main
runs-on: ubuntu-latest
needs: build
if: github.event_name == 'release'
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
with:
ref: dev
- name: Get Release Version
id: releaseVersion
run: |
arrTag=(${GITHUB_REF//\// })
VERSION="${arrTag[2]}"
echo Version: $VERSION
VERSION="${VERSION:1}"
echo Clean Version: $VERSION
echo "version=$VERSION" >> ${GITHUB_OUTPUT}
- name: Create Pull Request
id: cpr
env:
GH_TOKEN: ${{ secrets.PAT }}
run: |
git fetch origin main
pr_number=$(gh pr create --base main --head dev --assignee pingu2k4 --fill --label automated --label release --title "Merge v${{ steps.releaseVersion.outputs.version }}" | grep -o 'https://github.com/[^/]\+/[^/]\+/pull/\([0-9]\+\)' | awk -F '/' '{print $NF}')
echo PR Number: $pr_number
echo "prNumber=$pr_number" >> ${GITHUB_OUTPUT}
- name: Merge Pull Request
if: ${{ steps.cpr.outputs.prNumber }}
env:
GH_TOKEN: ${{ secrets.PAT }}
run: |
gh pr merge ${{ steps.cpr.outputs.prNumber }} --auto --merge