-
Notifications
You must be signed in to change notification settings - Fork 52
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
[WIP] update licenses #675
base: 2023.06-software.eessi.io
Are you sure you want to change the base?
Changes from all commits
062b624
e517a4e
1480ae1
bbb8ee9
3355eb2
2d7826e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Check and update licenses | ||
|
||
on: | ||
push: | ||
branches: [ "*-software.eessi.io" ] | ||
pull_request: | ||
branches: [ "*-software.eessi.io" ] | ||
permissions: | ||
contents: write # set permissions for writing | ||
|
||
jobs: | ||
license_update: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout out software-layer repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Run license script and generate patch | ||
id: check_licenses | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
python update_licenses.py --source=pypi TensorFlow | ||
python update_licenses.py --source=github:easybuilders/easybuild EasyBuild | ||
Comment on lines
+29
to
+30
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You are going to need to extract the software name from the easystack file, that is complicated. Perhaps instead you should add There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could also help you decide where to look for licenses (since you have access to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The other option is to gather software (and extension) names via |
||
if [ -f license_update.patch ] && [ -s license_update.patch ]; then | ||
PATCH_CONTENT=$(cat license_update.patch) | ||
echo "patch=$PATCH_CONTENT" >> $GITHUB_OUTPUT | ||
fi | ||
|
||
- name: Create a PR (if changes detected) | ||
id: create_pull_request | ||
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 | ||
if: steps.check_licenses.outputs.patch != '' | ||
with: | ||
commit-message: "Auto PR: Update licenses" | ||
title: "Auto PR: Update licenses" | ||
body: ${{ steps.check_licenses.outputs.patch }} | ||
branch: update-licenses-${{ github.run_number }} | ||
base: [ "*-software.eessi.io" ] | ||
Comment on lines
+36
to
+45
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Doesn't this mean that if a PR adds software, then it will trigger another PR to add the licence of the software to the yaml file? Instead, wouldn't you want to make a suggestion that they add the licence as part of the original PR? |
||
|
||
- name: Apply patch (if no PR created) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why wouldn't the PR be created? Wouldn't that mean the previous step will have failed? |
||
if: steps.create_pull_request.outputs.number == '' && steps.check_licenses.outputs.patch != '' | ||
run: | | ||
if [ -f license_update.patch ] && [ -s license_update.patch ]; then | ||
git apply license_update.patch | ||
else | ||
echo "No changes to apply" | ||
fi | ||
git add licenses.json | ||
git diff --cached --exit-code || git commit -m "Update licenses.json" | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
Comment on lines
+47
to
+59
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Rather than auto-apply a patch, can a code suggestion be made (or a PR to the source repo using a token without write permission to |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
name: Check and update licenses | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Duplicate file? |
||
|
||
on: | ||
push: | ||
branches: [ "*-software.eessi.io" ] | ||
pull_request: | ||
branches: [ "*-software.eessi.io" ] | ||
permissions: | ||
contents: write # set permissions for writing | ||
|
||
jobs: | ||
license_update: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout out software-layer repository | ||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@0a5c61591373683505ea898e09a3ea4f39ef2b9c | ||
with: | ||
python-version: '3.9' | ||
|
||
- name: Run license script and generate patch | ||
id: check_licenses | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
python update_licenses.py --source=pypi TensorFlow | ||
python update_licenses.py --source=github:easybuilders/easybuild EasyBuild | ||
if [ -f license_update.patch ] && [ -s license_update.patch ]; then | ||
PATCH_CONTENT=$(cat license_update.patch) | ||
echo "patch=$PATCH_CONTENT" >> $GITHUB_OUTPUT | ||
fi | ||
|
||
- name: Create a PR (if changes detected) | ||
id: create_pull_request | ||
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7.0.5 | ||
if: steps.check_licenses.outputs.patch != '' | ||
with: | ||
commit-message: "Auto PR: Update licenses" | ||
title: "Auto PR: Update licenses" | ||
body: ${{ steps.check_licenses.outputs.patch }} | ||
branch: update-licenses-${{ github.run_number }} | ||
base: [ "*-software.eessi.io" ] | ||
|
||
- name: Apply patch (if no PR created) | ||
if: steps.create_pull_request.outputs.number == '' && steps.check_licenses.outputs.patch != '' | ||
run: | | ||
if [ -f license_update.patch ] && [ -s license_update.patch ]; then | ||
git apply license_update.patch | ||
else | ||
echo "No changes to apply" | ||
fi | ||
git add licenses.json | ||
git diff --cached --exit-code || git commit -m "Update licenses.json" | ||
git push | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This action is being given a lot of power at a global level, do we really need it to have
write
permissions? Isn't it enough that we get a notification if it fails?