This repository has been archived by the owner on Dec 8, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
48 lines (43 loc) · 1.74 KB
/
update-checksum.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
name: File Checksum Updater
on:
workflow_dispatch:
inputs:
branch:
description: 'Target branch to raise PR'
required: true
jobs:
generate-checksum:
name: Update checksums.json file.
runs-on: ubuntu-latest
steps:
# Setup Python
- name: Install Python3
uses: actions/setup-python@v2
with:
python-version: 3.7.10
architecture: x64
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.inputs.branch }}
- name: Run checksum generator
run: python3 .github/scripts/generate_checksum.py --root ./
- name: Raise Pull Request if checksums.json file changed
run: |
if ! (git diff --quiet checksums.json); then
git config --global user.name "Checksum Updater"
git checkout -b job/update-checksum-file
export COMMIT=$(git rev-parse HEAD)
git commit -am 'Generate new checksums.json file for commit $COMMIT'
git push --set-upstream origin job/update-checksum-file
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key 23F3D4EA75716059
sudo apt-add-repository https://cli.github.com/packages
sudo apt update
sudo apt-get install gh
gh pr create --base ${{ github.event.inputs.branch }} --title 'Update checksums.json file' --body 'Checksum Updater Job: PR to update checksums.json file for commit $COMMIT'
else
echo 'checksums.json file did not change after running script. Not creating a Pull-Request.'
fi