-
Notifications
You must be signed in to change notification settings - Fork 119
36 lines (31 loc) · 1.29 KB
/
assert_license_statement.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
name: Assert PR description license statement
on:
pull_request:
types: [opened, edited]
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
check-pr-description:
if: github.repository_owner == 'aws'
runs-on: ubuntu-latest
steps:
- name: Install jq
run: |
sudo apt-get update -o Acquire::Languages=none -o Acquire::Translation=none
sudo apt-get install -y jq
- name: Check PR description
run: |
# Fetches the PR description.
PR_DESCRIPTION=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }} | jq -r .body)
LICENSE_STATEMENT="By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license."
echo "PR description: ${PR_DESCRIPTION}"
echo "Must contain: ${LICENSE_STATEMENT}"
# Assert this is the case.
if echo "${PR_DESCRIPTION}" | grep -q "${LICENSE_STATEMENT}"; then
echo "PR description contains license statement."
else
echo "Error: PR description does not contain the required license statement."
exit 1
fi