Fix 3rd party license updater (#92)

df03a94 · Paulo F. Oliveira · 2022-02-22 10:54

4 files +21 -4
Message
{commit_body(@commit)}

Files changed

modified .github/workflows/update_3rd_party_licenses.sh
+19 −4
@@ -4,10 +4,25 @@ set -eux
4 4
5 5 git config user.name "GitHub Actions"
6 6 git config user.email "actions@user.noreply.github.com"
7 git checkout main
8 7
8 +BRANCH=feature/3rd-party-licenses-update
9 +
10 +if git branch -a | grep "$BRANCH" > /dev/null; then
11 + # already exists
12 + exit
13 +fi
14 +
15 +git fetch origin
16 +git checkout -b "$BRANCH"
9 17 npm run licenses
10 18
11 git add 3RD_PARTY_LICENSES
12 git commit -m "Update 3rd party licenses" || true
13 git push origin
19 +if ! git diff --exit-code 1> /dev/null ; then
20 + # there's stuff to push
21 + git add 3RD_PARTY_LICENSES
22 + git commit -m "Update 3rd party licenses"
23 + git push origin "$BRANCH"
24 +
25 + gh pr create --fill \
26 + --title "Update 3rd party licenses (automation)" \
27 + --body "This is an automated action to update the action's 3rd party licenses"
28 +fi
modified .github/workflows/update_3rd_party_licenses.yml
+2 −0
@@ -17,3 +17,5 @@ jobs:
17 17 node-version: '14'
18 18 - run:
19 19 ./.github/workflows/update_3rd_party_licenses.sh
20 + env:
21 + GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}

Parents: 6c5caca