Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add GitHub Action for updating license file for dependabot branches #1517

Merged
merged 10 commits into from
May 3, 2022
33 changes: 33 additions & 0 deletions .github/workflows/update_license.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Update license file

on:
push:
branches:
- 'dependabot/**'

jobs:
update_license_file:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: npm ci

- name: Install git-secrets
run: npm run install-git-secrets

- name: Update license file
run: npm run license

- name: Push changes if license file changed
run: |
if [ -n "$(git status --porcelain | grep "THIRD-PARTY-LICENSES.csv")" ]; then
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add THIRD-PARTY-LICENSES.csv
git commit -m "Update license file"
git push
else
echo "There were no changes to THIRD-PARTY-LICENSE.csv"
fi