Closed tarun-mitruka closed 10 months ago
Did you already do something about that? I think we could use a tool (e.g. https://pypi.org/project/licenseheaders/) for that?
With that I think its also possible to update license headers as a precommit hook
I didn't looked into it yet, but maybe you want to look into it, to get into github actions?
I can give you a start here:
I think it would be convenient to have a github action, which is triggered every year and by user request workflow_dispatch
.
For github actions there is the trigger:
on.schedule
https://docs.github.com/de/actions/using-workflows/workflow-syntax-for-github-actions#onpushpull_requestpull_request_targetpathspaths-ignore every year would be https://crontab.guru/every-year
name: Update License
on:
schedule:
- cron: '0 0 1 1 *'
workflow_dispatch:
jobs:
Run:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
path: 'repo'
token: ${{ secrets.PUSH_TO_PROTECTED_TOKEN }}
- name: Update headers
run: |
cd repo
# do crazy thing with python, e.g. pip install licenseheaders
git config --local user.email "mueller@ibb.uni-stuttgart.de"
git config --local user.name "AlexanderMueller"
git remote set-url origin https://${{ secrets.ORGANIZATION_TOKEN }}@github.com/ikarus-project/ikarus.git
git add .
git commit -m "Create release v$NEWVERSION"
git push origin
BTW. I don't know what year we should use there https://reuse.software/faq/#years-copyright maybe also the whole period would be reasonable "2021-X"
EDIT: this should only happen to main therefore you should only run this on main.
EDIT2: and as a user and e-mail there are also bots or defaults to do this. This does not have be me
For the EDIT2:
you can use - uses: fregante/setup-git-user@v2 to register a default user is is basically only doing https://github.com/fregante/setup-git-user/blob/77c1b5542f14ab6db4b8462d6857e31deb988b09/action.yml#L13-L14
Yes I can look into that. It would be good to have that before new year, so we can actually test it if it really works automatically ;)
I tried to use that python Package, but it didn't really do what I wanted, so I think i might just right a simple python code that checks if each file has a LICENSE HEADER, and if yes potentially update it, if no add it, this shouldn't be too hard (also this package wasn't updated in a long time, the PyPy Package is way older than the github master)
Hmm I couldn't find something finished maybe we can just do regex and write a python code which goes to every file. https://regex101.com/r/nG1gU7/1232
Do we want
// SPDX-FileCopyrightText: 2022 The Ikarus Developers mueller@ibb.uni-stuttgart.de
or rather
// SPDX-FileCopyrightText: 2021-2023 The Ikarus Developers mueller@ibb.uni-stuttgart.de
I think for now every file has 2022 in it
I think the second one is nicer?
is inconsistent with
in
ikarus/utils/init.hh