-
Notifications
You must be signed in to change notification settings - Fork 1
73 lines (62 loc) 路 1.82 KB
/
Copy pathauto-check-workflow.yml
File metadata and controls
73 lines (62 loc) 路 1.82 KB
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
name: Initialise Repo
on:
push:
branches:
# NB: its difficult to get the default branch dynamically in
# push event, so it has been hardcoded.
# ${{ github.event.repository.default_branch }} does not
# work in this scenario.
#
- main
permissions:
contents: write
workflows: write
jobs:
run-script:
name: run script
# We will only run this action when this repository isn't the
# template repository
#
if: >-
${{ !github.event.repository.is_template }}
runs-on: ubuntu-latest
steps:
- name: Configure Git
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
shell: bash
- name: Checkout
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- name: Run script
run: |
go run ./scripts/automate-checklist.go
shell: bash
- name: Go Format
run: |
go fmt ./...
shell: bash
- name: Go Mod Tidy
run: |
go mod tidy
shell: bash
- name: Clean up redundant scripts
run: |
rm -fv .github/workflows/auto-check-workflow.yml 2>/dev/null
rm -fv ./scripts/automate-checklist.sh 2>/dev/null
rm -fv ./scripts/automate-checklist.go 2>/dev/null
shell: bash
- name: Add files and commit changes
run: |
git add .
if [ -n "$(git status --porcelain)" ]; then
git commit -m "chore(gh-actions): apply auto-check edits"
git push -u origin ${{ github.event.repository.default_branch }}
else
echo "No changes to commit"
fi
shell: bash
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}