summaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2020-01-09 20:37:05 -0700
committerGitHub <noreply@github.com>2020-01-09 20:37:05 -0700
commit6e7f8590402967bffbdd0bb0ae241180910fcd2c (patch)
tree506f2d0983e05ab7b9e38a5f5e28d0481640d16d /.github/workflows
parent3aaa0f2760527f34ffe0e4c67fc4bb6078ce2b4d (diff)
downloadvyos-cloud-init-6e7f8590402967bffbdd0bb0ae241180910fcd2c.tar.gz
vyos-cloud-init-6e7f8590402967bffbdd0bb0ae241180910fcd2c.zip
workflows: add contributor license agreement checker (#155)
Check whether the pull request submitter has signed the CLA due to presence of github.actor in tools/.lp-to-git-user Set 'CLA signed' if present, 'CLA not signed' label if absent * grep for the full github username in CLA file Co-authored-by: Daniel Watkins <daniel@daniel-watkins.co.uk>
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/cla.yml29
1 files changed, 29 insertions, 0 deletions
diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml
new file mode 100644
index 00000000..34e11c2d
--- /dev/null
+++ b/.github/workflows/cla.yml
@@ -0,0 +1,29 @@
+name: Verify Contributor License Agreement
+
+on: [pull_request]
+
+jobs:
+ cla-validate:
+
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v1
+ - run: |
+ echo "::set-env name=CLA_SIGNED::$(grep -q ': \"${{ github.actor }}\"' ./tools/.lp-to-git-user && echo CLA signed || echo CLA not signed)"
+ - name: Add CLA label
+ run: |
+ # POST a new label to this issue
+ curl --request POST \
+ --url https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/labels \
+ --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
+ --header 'content-type: application/json' \
+ --data '{"labels": ["${{env.CLA_SIGNED}}"]}'
+ - name: Comment about CLA signing
+ if: env.CLA_SIGNED == 'CLA not signed'
+ run: |
+ # POST a comment directing submitter to sign the CLA
+ curl --request POST \
+ --url https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.number }}/comments \
+ --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
+ --header 'content-type: application/json' \
+ --data '{"body": "Hello ${{ github.actor }},\n\nThank you for your contribution to cloud-init.\n\nIn order for us to merge this pull request, you need\nto have signed the Contributor License Agreement (CLA).\nPlease ensure that you have signed the CLA by following our\nhacking guide at:\n\nhttps://cloudinit.readthedocs.io/en/latest/topics/hacking.html\n\nThanks,\nYour friendly cloud-init upstream\n"}'