Skip to content
This repository has been archived by the owner on Dec 26, 2022. It is now read-only.

👷 Add a license generator #381

Merged
merged 4 commits into from
Jan 11, 2022
Merged
Show file tree
Hide file tree
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
18 changes: 18 additions & 0 deletions .github/scripts/license_generator.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from glob import glob

pincer_license = """# Copyright Pincer 2021-Present
# Full MIT License can be found in `LICENSE` at the project root.

"""


for file in glob("./pincer/**/*.py", recursive=True):
if file == "./pincer/__init__.py":
continue

with open(file, "r+") as f:
lines = f.readlines()
if not lines[0].startswith("# Copyright Pincer 2021-Present\n"):
lines.insert(0, pincer_license)
f.seek(0)
f.writelines(lines)
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Sort Alls
name: Run Scripts

on: push

Expand All @@ -16,17 +16,19 @@ jobs:
python-version: '3.8'
architecture: 'x64'

- name: running script
run: python ./.github/scripts/all_sorter.py

- name: setup git
run: |
git config user.name "GitHub Actions"
git config user.email "[email protected]"
git pull

- name: add to git
- name: running all sorter
run: |
git pull
git add .
git diff-index --quiet HEAD || git commit -m ":art: Automatic `__all__` sorting"
git push
python ./.github/scripts/all_sorter.py
git diff-index --quiet HEAD || git commit -am ":art: Automatic `__all__` sorting"


- name: running license generator
run: |
python ./.github/scripts/license_generator.py
git diff-index --quiet HEAD || git commit -am ":page_facing_up: Automatic license generator"