Skip to content

Commit b73973e

Browse files
authored
Merge pull request #1854 from oracle-devrel/ao-plt-updates
Additional licenses and github workflows for solutions hub
2 parents facdc63 + a2ee960 commit b73973e

File tree

6 files changed

+492
-0
lines changed

6 files changed

+492
-0
lines changed
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
name: Banned file changes (PR)
2+
on:
3+
# pull_request:
4+
# branches: [ "**/*" ]
5+
pull_request_target:
6+
7+
jobs:
8+
check_for_banned_file_changes:
9+
name: Look for unsupported (banned) file modifications on PRs
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: 'Get number of git commits'
13+
uses: oracle-devrel/[email protected]
14+
id: num_commits
15+
with:
16+
pull_url: ${{ github.event.pull_request.url }}
17+
- name: 'Checkout repo'
18+
uses: actions/checkout@v2
19+
with:
20+
ref: ${{ github.event.pull_request.head.ref }}
21+
repository: ${{ github.event.pull_request.head.repo.full_name }}
22+
fetch-depth: ${{ steps.num_commits.outputs.fetch_depth }}
23+
- name: Get file changes
24+
uses: oracle-devrel/[email protected]
25+
id: files
26+
with:
27+
pull_url: ${{ github.event.pull_request.url }}
28+
- name: Look for changes to .github
29+
if: contains(steps.files.outputs.all_files_changed, '.github')
30+
run: |
31+
echo 'Changes to files in .github are not allowed.'
32+
- name: Comment if .github changed
33+
if: contains(steps.files.outputs.all_files_changed, '.github')
34+
uses: oracle-devrel/add-pr-comment
35+
with:
36+
message: |
37+
:no_entry: **Banned Files Modified**
38+
Changes to files in `.github` are not permitted. Please revert your changes and re-submit a new PR. Simply changing the file back to its original state and re-committing won't work (you must revert the changes made to it).
39+
repo-token: ${{ secrets.GITHUB_TOKEN }}
40+
- name: Look for changes to license_policy.yml
41+
if: contains(steps.files.outputs.all_files_changed, '"license_policy.yml"')
42+
run: |
43+
echo 'Changes to license_policy.yml are not allowed.'
44+
- name: Comment if license_policy.yml changed
45+
if: contains(steps.files.outputs.all_files_changed, '"license_policy.yml"')
46+
uses: oracle-devrel/add-pr-comment
47+
with:
48+
message: |
49+
:no_entry: **Banned Files Modified**
50+
Changes to `license_policy.yml` are not permitted. Please revert your changes and re-submit a new PR. Simply changing the file back to its original state and re-committing won't work (you must revert the changes made to it).
51+
repo-token: ${{ secrets.GITHUB_TOKEN }}
52+
- name: Look for changes to repolinter.json
53+
if: contains(steps.files.outputs.all_files_changed, '"repolinter.json"')
54+
uses: oracle-devrel/add-pr-comment
55+
with:
56+
message: |
57+
:no_entry: **Banned Files Modified**
58+
Changes to `repolinter.json` are not permitted. Please revert your changes and re-submit a new PR. Simply changing the file back to its original state and re-committing won't work (you must revert the changes made to it).
59+
repo-token: ${{ secrets.GITHUB_TOKEN }}
60+
- name: Comment if repolinter.json changed
61+
if: contains(steps.files.outputs.all_files_changed, '"repolinter.json"')
62+
run: |
63+
echo 'Changes to repolinter.json are not allowed.'
64+
- name: Look for changes to sonar-project.properties
65+
if: contains(steps.files.outputs.all_files_changed, '"sonar-project.properties"')
66+
uses: oracle-devrel/add-pr-comment
67+
with:
68+
message: |
69+
:no_entry: **Banned Files Modified**
70+
Changes to `sonar-project.properties` are not permitted. Please revert your changes and re-submit a new PR. Simply changing the file back to its original state and re-committing won't work (you must revert the changes made to it).
71+
repo-token: ${{ secrets.GITHUB_TOKEN }}
72+
- name: Comment if sonar-project.properties changed
73+
if: contains(steps.files.outputs.all_files_changed, '"sonar-project.properties"')
74+
run: |
75+
echo 'Changes to sonar-project.properties are not allowed.'
76+
- name: Fail on banned file changes
77+
if: contains(steps.files.outputs.all_files_changed, '.github') || contains(steps.files.outputs.all_files_changed, '"license_policy.yml"') || contains(steps.files.outputs.all_files_changed, '"repolinter.json"') || contains(steps.files.outputs.all_files_changed, '"sonar-project.properties"')
78+
run: |
79+
exit 1
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: "CLA Assistant"
2+
on:
3+
issue_comment:
4+
types: [created]
5+
pull_request_target:
6+
types: [opened,closed,synchronize]
7+
8+
jobs:
9+
CLAssistant:
10+
runs-on: ubuntu-latest
11+
steps:
12+
- name: "CLA Assistant"
13+
if: (github.event.comment.body == 'recheck' || github.event.comment.body == 'I have read the CLA Document and I hereby sign the CLA') || github.event_name == 'pull_request_target'
14+
# Beta Release
15+
uses: cla-assistant/[email protected]
16+
env:
17+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18+
# the below token should have repo scope and must be manually added by you in the repository's secret
19+
PERSONAL_ACCESS_TOKEN : ${{ secrets.PERSONAL_ACCESS_TOKEN }}
20+
with:
21+
# for per-repo CLA-acceptance:
22+
# path-to-signatures: 'signatures/oca-20210504/${{ github.repository }}'
23+
# for per-GHO CLA-acceptance:
24+
path-to-signatures: 'signatures/oca-20210504/oracledevrel'
25+
path-to-document: 'https://github.com/oracledevrel/devrel-oca-mgmt/blob/main/oca-20210504.md' # e.g. a CLA or a DCO document
26+
# branch should not be protected
27+
branch: 'main'
28+
allowlist: bot*
29+
30+
#below are the optional inputs - If the optional inputs are not given, then default values will be taken
31+
remote-organization-name: "oracledevrel" # enter the remote organization name where the signatures should be stored (Default is storing the signatures in the same repository)
32+
remote-repository-name: "devrel-oca-mgmt" # enter the remote repository name where the signatures should be stored (Default is storing the signatures in the same repository)
33+
#create-file-commit-message: 'For example: Creating file for storing CLA Signatures'
34+
#signed-commit-message: 'For example: $contributorName has signed the CLA in #$pullRequestNo'
35+
#custom-notsigned-prcomment: 'pull request comment with Introductory message to ask new contributors to sign'
36+
#custom-pr-sign-comment: 'The signature to be committed in order to sign the CLA'
37+
#custom-allsigned-prcomment: 'pull request comment when all contributors has signed, defaults to **CLA Assistant Lite bot** All Contributors have signed the CLA.'
38+
#lock-pullrequest-aftermerge: false - if you don't want this bot to automatically lock the pull request after merging (default - true)
39+
#use-dco-flag: true - If you are using DCO instead of CLA
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: Audit licenses
2+
on:
3+
pull_request_target:
4+
5+
jobs:
6+
run_scancode_toolkit:
7+
name: Get inventory of licenses used in project
8+
runs-on: ubuntu-latest
9+
container:
10+
image: ghcr.io/oracledevrel/scancode-toolkit:v21.3.31
11+
credentials:
12+
username: ${{ github.actor }}
13+
password: ${{ secrets.GHCR_PAT }}
14+
steps:
15+
- name: 'Checkout repo'
16+
uses: actions/checkout@v2
17+
with:
18+
ref: ${{ github.event.pull_request.head.ref }}
19+
repository: ${{ github.event.pull_request.head.repo.full_name }}
20+
- name: Run Scancode-toolkit
21+
run: |
22+
scancode -l --ignore licenses.json --ignore .github/**/* --ignore license_policy.yml --license-policy license_policy.yml --only-findings --summary --json-pp licenses.json *
23+
echo "\n\nHere is the licenses.json:\n"
24+
echo $(cat licenses.json)
25+
- name: Look for non-approved licenses
26+
uses: oracle-devrel/[email protected]
27+
id: analysis
28+
with:
29+
licenses_file: '/github/workspace/licenses.json'
30+
- name: Analysis results
31+
run: echo "${{ steps.analysis.outputs.unapproved_licenses }}"
32+
- name: Comment if analysis finds unapproved licenses
33+
if: steps.analysis.outputs.unapproved_licenses == 'true'
34+
uses: oracle-devrel/add-pr-comment
35+
with:
36+
message: |
37+
:no_entry: **License Inspection**
38+
Requires manual inspection. There are some licenses which dictate further analysis and review.
39+
repo-token: ${{ secrets.GITHUB_TOKEN }}
40+
- name: Halt pipeline on unapproved licenses
41+
if: steps.analysis.outputs.unapproved_licenses == 'true'
42+
run: exit 1
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
name: Release ZIP file packaging
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
create_zip:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: 'Checkout repo'
12+
uses: actions/checkout@v2
13+
- name: 'Make (and upload) ZIP file(s)'
14+
uses: oracle-devrel/[email protected]
15+
id: zip_maker
16+
with:
17+
github_token: ${{ secrets.GITHUB_TOKEN }}
18+
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
name: Repolinter
2+
on:
3+
pull_request_target:
4+
jobs:
5+
run_repolinter:
6+
name: Run Repolinter on pull request
7+
runs-on: ubuntu-latest
8+
container:
9+
image: ghcr.io/oracledevrel/repolinter:v0.11.1
10+
credentials:
11+
username: ${{ github.actor }}
12+
password: ${{ secrets.GHCR_PAT }}
13+
steps:
14+
- name: 'Checkout repo'
15+
uses: actions/checkout@v2
16+
with:
17+
ref: ${{ github.event.pull_request.head.ref }}
18+
repository: ${{ github.event.pull_request.head.repo.full_name }}
19+
- name: Run Repolinter
20+
run: |
21+
set +e
22+
bundle exec /app/bin/repolinter.js lint --format json --rulesetFile repolinter.json . > repolinter_results.json
23+
echo "\n\nHere is the repolinter_results.json:\n"
24+
echo $(cat repolinter_results.json)
25+
exit 0
26+
- name: Analyze the Repolinter results
27+
uses: oracle-devrel/[email protected]
28+
id: analysis
29+
with:
30+
json_results_file: '/github/workspace/repolinter_results.json'
31+
- name: Overall analysis results
32+
run: |
33+
echo "Passed: ${{ steps.analysis.outputs.passed }}"
34+
echo "Errored: ${{ steps.analysis.outputs.errored }}"
35+
- name: Comment if analysis finds missing disclaimer
36+
if: steps.analysis.outputs.disclaimer_found == 'false'
37+
uses: oracle-devrel/add-pr-comment
38+
with:
39+
message: |
40+
:no_entry: **FAILURE: Missing Disclaimer**
41+
The standard Oracle Disclaimer seems to be missing from the readme. Please add it:
42+
43+
ORACLE AND ITS AFFILIATES DO NOT PROVIDE ANY WARRANTY WHATSOEVER, EXPRESS OR IMPLIED, FOR ANY SOFTWARE, MATERIAL OR CONTENT OF ANY KIND CONTAINED OR PRODUCED WITHIN THIS REPOSITORY, AND IN PARTICULAR SPECIFICALLY DISCLAIM ANY AND ALL IMPLIED WARRANTIES OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A PARTICULAR PURPOSE. FURTHERMORE, ORACLE AND ITS AFFILIATES DO NOT REPRESENT THAT ANY CUSTOMARY SECURITY REVIEW HAS BEEN PERFORMED WITH RESPECT TO ANY SOFTWARE, MATERIAL OR CONTENT CONTAINED OR PRODUCED WITHIN THIS REPOSITORY. IN ADDITION, AND WITHOUT LIMITING THE FOREGOING, THIRD PARTIES MAY HAVE POSTED SOFTWARE, MATERIAL OR CONTENT TO THIS REPOSITORY WITHOUT ANY REVIEW. USE AT YOUR OWN RISK.
44+
45+
Details:
46+
${{ steps.analysis.outputs.disclaimer_details }}
47+
repo-token: ${{ secrets.GITHUB_TOKEN }}
48+
- name: Comment if analysis finds missing readme
49+
if: steps.analysis.outputs.readme_file_found == 'false'
50+
uses: oracle-devrel/add-pr-comment
51+
with:
52+
message: |
53+
:no_entry: **FAILURE: Missing README**
54+
The README file seems to be missing. Please add it.
55+
56+
Details:
57+
${{ steps.analysis.outputs.readme_file_details }}
58+
repo-token: ${{ secrets.GITHUB_TOKEN }}
59+
- name: Comment if analysis finds missing license
60+
if: steps.analysis.outputs.license_file_found == 'false'
61+
uses: oracle-devrel/add-pr-comment
62+
with:
63+
message: |
64+
:no_entry: **FAILURE: Missing LICENSE**
65+
The LICENSE file seems to be missing. Please add it.
66+
67+
Details:
68+
${{ steps.analysis.outputs.license_file_details }}
69+
repo-token: ${{ secrets.GITHUB_TOKEN }}
70+
- name: Comment if analysis finds copyright notice missing
71+
if: steps.analysis.outputs.copyright_found == 'false'
72+
uses: oracle-devrel/add-pr-comment
73+
with:
74+
message: |
75+
:warning: **WARNING: Missing Copyright Notice(s)**
76+
It's a good idea to have copyright notices at the top of each file. It looks like at least one file was missing this (though it might be further down in the file - this might be a false-positive).
77+
78+
Details:
79+
${{ steps.analysis.outputs.copyright_details }}
80+
repo-token: ${{ secrets.GITHUB_TOKEN }}
81+
- name: Halt pipeline if README is missing
82+
if: steps.analysis.outputs.readme_file_found == 'false'
83+
run: exit 1
84+
- name: Halt pipeline if LICENSE is missing
85+
if: steps.analysis.outputs.license_file_found == 'false'
86+
run: exit 1
87+
- name: Halt pipeline if disclaimer is missing
88+
if: steps.analysis.outputs.disclaimer_found == 'false'
89+
run: exit 1

0 commit comments

Comments
 (0)