summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChad Smith <chad.smith@canonical.com>2020-03-10 14:10:07 -0600
committerGitHub <noreply@github.com>2020-03-10 16:10:07 -0400
commitaea652990cc3d39e5b5e5dbddd1d8190a4621563 (patch)
tree66f769365a69dc2d851ead98ae0ff4be943078ca
parent64c33704853087c05c54e157fc42a340a4350159 (diff)
downloadvyos-cloud-init-aea652990cc3d39e5b5e5dbddd1d8190a4621563.tar.gz
vyos-cloud-init-aea652990cc3d39e5b5e5dbddd1d8190a4621563.zip
workflows: CLA validation altered to fail status on pull_request (#164)
Github api doesn't allow read-write access to labels or comments when running from a pull_request fork during CI. This restriction results in an API error message: "Resource not accessible by integration" If we want to run this action per pull_request, we need to convert the action to fail the PR status check and emit the required steps to sign the CLA to the console on the PR's failed status tab.
-rw-r--r--.github/workflows/cla.yml36
1 files changed, 18 insertions, 18 deletions
diff --git a/.github/workflows/cla.yml b/.github/workflows/cla.yml
index 34e11c2d..757e8ff1 100644
--- a/.github/workflows/cla.yml
+++ b/.github/workflows/cla.yml
@@ -8,22 +8,22 @@ jobs:
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
+ - name: Check CLA signing status for ${{ github.actor}}
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"}'
+ cat > unsigned-cla.txt <<EOF
+ Hello ${{ github.actor }},
+
+ Thank you for your contribution to cloud-init.
+
+ In order for us to merge this pull request, you need
+ to have signed the Contributor License Agreement (CLA).
+ Please sign the CLA by following our
+ hacking guide at:
+ https://cloudinit.readthedocs.io/en/latest/topics/hacking.html
+
+ Thanks,
+ Your friendly cloud-init upstream
+ EOF
+ grep -q ': \"${{ github.actor }}\"' ./tools/.lp-to-git-user && \
+ echo "Thanks ${{ github.actor }} for signing cloud-init's CLA" || \
+ (cat unsigned-cla.txt && exit 1)