-
-
Notifications
You must be signed in to change notification settings - Fork 6
68 lines (57 loc) · 2.18 KB
/
fitgen.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
name: Run fitgen Triggered by Comment
on:
issue_comment:
types:
- created
jobs:
run-fitgen:
runs-on: ubuntu-latest
steps:
- name: Check PR comment
id: check-comment
run: |
echo "trigger=${{ startsWith(github.event.comment.body, 'run fitgen') }}" >> $GITHUB_OUTPUT
if [[ "${{ startsWith(github.event.comment.body, 'run fitgen') }}" == "false" ]]; then
echo "Aborted: no command found"
exit 0
fi
if [[ "${{ github.event.comment.body }}" =~ ^run\ fitgen\ ([0-9]+\.[0-9]+)$ ]]; then
echo "sdkversion=${BASH_REMATCH[1]}" >> $GITHUB_OUTPUT
else
echo "Aborted: not a valid 'run fitgen <sdk.version>' command"
exit 0
fi
- uses: actions/checkout@v4
if: steps.check-comment.outputs.trigger == 'true'
with:
token: "${{ secrets.FIT }}"
- name: Checkout PR
if: steps.check-comment.outputs.trigger == 'true'
env:
GITHUB_TOKEN: ${{ secrets.FIT }}
run: |
gh pr checkout ${{ github.event.issue.number }}
- name: Set up Go
if: steps.check-comment.outputs.trigger == 'true'
uses: actions/setup-go@v4
with:
go-version: ">=1.18"
- name: Run fitgen
if: steps.check-comment.outputs.trigger == 'true'
run: |
export wd=$(pwd)
echo $wd
cd internal/cmd/fitgen
go run main.go -f Profile.xlsx -p ../../../ -b all --sdk-version ${{ steps.check-comment.outputs.sdkversion }} --verbose -y
cd $wd
sed -E -i 's/sdkversion\-[0-9]+\.[0-9]+-lightblue.svg/\sdkversion-${{ steps.check-comment.outputs.sdkversion }}-lightblue.svg/' README.md
- name: Commit and Push
if: steps.check-comment.outputs.trigger == 'true'
env:
GITHUB_TOKEN: ${{ secrets.FIT }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "Hikmatulloh Hari Mukti"
git add .
git commit -m "gh actions: generate files for v${{ steps.check-comment.outputs.sdkversion }}"
git push