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

Implement a GitHub workflow to automatically run add_license.py #2

Merged
merged 3 commits into from
Mar 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions .github/workflows/add-license.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Add License

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:

add-license:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Required to retrieve full commit history

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.12"

- name: Add License
run: |
python scripts/add_license.py

- name: Check for file changes
id: changes
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "::set-output name=changes::true"
else
echo "::set-output name=changes::false"
fi

- name: Commit changes
if: steps.changes.outputs.changes == true
run: |
git config --global user.name "GitHub Actions Bot"
git config --global user.email "[email protected]"
git add .
git commit -m "Add license to files"
git push
Loading