From b7a1edd04a602a91e3876fb209e5b78e1b447c58 Mon Sep 17 00:00:00 2001 From: Nanne Baars Date: Wed, 29 Sep 2021 19:56:22 +0200 Subject: [PATCH] Use CLA again and add action to recheck it --- .github/workflows/master_branch_pr.yml | 18 ---------- .github/workflows/recheck-cla.yml | 14 ++++++++ .github/workflows/signoff_mr.yml | 47 -------------------------- PULL_REQUEST_TEMPLATE.md | 1 - 4 files changed, 14 insertions(+), 66 deletions(-) delete mode 100644 .github/workflows/master_branch_pr.yml create mode 100644 .github/workflows/recheck-cla.yml delete mode 100644 .github/workflows/signoff_mr.yml diff --git a/.github/workflows/master_branch_pr.yml b/.github/workflows/master_branch_pr.yml deleted file mode 100644 index a184aa71b..000000000 --- a/.github/workflows/master_branch_pr.yml +++ /dev/null @@ -1,18 +0,0 @@ -on: - pull_request: - pull_request_target: - branches: [master] - -jobs: - test: - runs-on: ubuntu-latest - steps: - - uses: wow-actions/auto-comment@v1 - with: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - pullRequestOpened: | - 👋 @{{ author }} - It looks like this pull request has been made against the ${{github.event.pull_request.head.repo.full_name}} `master` branch. - Since we use Git Flow all commits to master are through are from the develop branch. - You do not need to close this PR, you can change the target branch to `development` by clicking the _"Edit"_ button at the top of this page. \ No newline at end of file diff --git a/.github/workflows/recheck-cla.yml b/.github/workflows/recheck-cla.yml new file mode 100644 index 000000000..940a68823 --- /dev/null +++ b/.github/workflows/recheck-cla.yml @@ -0,0 +1,14 @@ +name: "Check CLA signed" +on: + issue_comment: + types: [created] +jobs: + rebase: + name: signed + if: github.repository == 'WebGoat/WebGoat' && github.event.issue.pull_request != '' && contains(github.event.comment.body, '/cla') && github.event.comment.author_association == 'MEMBER' + runs-on: ubuntu-latest + steps: + - name: Recheck CLA + run: | + echo "Rechecking PR ${{ github.event.number }}" + curl "https://cla-assistant.io/check/WebGoat/WebGoat?pullRequest=${{ github.event.number }} \ No newline at end of file diff --git a/.github/workflows/signoff_mr.yml b/.github/workflows/signoff_mr.yml deleted file mode 100644 index 6c5ea27d1..000000000 --- a/.github/workflows/signoff_mr.yml +++ /dev/null @@ -1,47 +0,0 @@ -on: issue_comment - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/github-script@0.3.0 - if: github.event.action == 'created' - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const isValidSignOff = ( - context.payload.action === 'created' && - context.payload.issue.pull_request && - context.payload.comment.user.id === context.payload.issue.user.id && - context.payload.comment.body === '/signoff' - ) - if (!isValidSignOff) return - const pr = await github.pulls.get({ - ...context.repo, - pull_number: context.payload.issue.number - }) - const commits = await github.pulls.listCommits({ - ...context.repo, - pull_number: context.payload.issue.number - }) - const baseCommit = await github.git.getCommit({ - ...context.repo, - commit_sha: pr.data.head.sha - }) - const tree = await github.git.getTree({ - ...context.repo, - tree_sha: baseCommit.data.tree.sha - }) - const commitLines = commits.data.map(item => `- ${item.sha.slice(0, 6)}: ${item.commit.message}`).join('\n') - const header = `I, @${context.payload.comment.user.login}, hereby signoff on these commits:` - const newCommit = await github.git.createCommit({ - ...context.repo, - message: `${header}\n\n${commitLines}`, - tree: tree.data.sha, - parents: [pr.data.head.sha] - }) - await github.git.updateRef({ - ...context.repo, - ref: `heads/${pr.data.head.ref}`, - sha: newCommit.data.sha - }) \ No newline at end of file diff --git a/PULL_REQUEST_TEMPLATE.md b/PULL_REQUEST_TEMPLATE.md index 0f4d52c1a..8c1052540 100644 --- a/PULL_REQUEST_TEMPLATE.md +++ b/PULL_REQUEST_TEMPLATE.md @@ -1,7 +1,6 @@ Thank you for submitting a Pull Request to the WebGoat. Please make sure that: - [ ] Status checks have passed (e.g. packaging, linting, testing are fine) -- [ ] Commits are [signed off](https://git-scm.com/docs/git-commit#Documentation/git-commit.txt--s) or you have a commit which you amend with `git commit -m "Sign off" --amend --signof`. See [Contributing.md](https://github.com/WebGoat/WebGoat/blob/develop/CONTRIBUTING.md) for more details. If your PR is related to an issue. Please end your PR test with the following line: This PR closes #< insert number here >. \ No newline at end of file