-
Notifications
You must be signed in to change notification settings - Fork 178
64 lines (59 loc) · 1.88 KB
/
run-script-and-commit.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
name: Run Script and Commit Changes
# Unifies logic for running a script and commit specific changes to master. Used during release process and for updating changelog on merged PRs.
on:
workflow_call:
inputs:
script_call:
required: true
type: string
file_to_commit:
required: true
type: string
commit_message:
required: true
type: string
secrets:
apix_bot_pat:
required: true
remote:
required: true
gpg_private_key:
required: true
passphrase:
required: true
jobs:
run_script_and_commit:
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683
with:
fetch-depth: 0
token: ${{ secrets.apix_bot_pat }}
- uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed
with:
go-version-file: 'go.mod'
- name: Run specified script
run: ${{ inputs.script_call }}
- name: Import GPG key
id: import_gpg
uses: crazy-max/ghaction-import-gpg@cb9bde2e2525e640591a934b1fd28eef1dcaf5e5
with:
gpg_private_key: ${{ secrets.gpg_private_key }}
passphrase: ${{ secrets.passphrase }}
git_user_signingkey: true
git_commit_gpgsign: true
- name: Commit changes
run: |
if [[ $(git status --porcelain) ]]; then
git pull
git config --local user.email [email protected]
git config --local user.name svc-apix-bot
git remote set-url origin ${{ secrets.remote }}
git add ${{ inputs.file_to_commit }}
git commit -m "${{ inputs.commit_message }}"
git push
else
echo "No changes to commit."
fi