From 242c24c93bacfb7ea78fbf6bd98e3b44f9439f3e Mon Sep 17 00:00:00 2001 From: paketo-bot Date: Fri, 14 May 2021 19:05:16 +0000 Subject: [PATCH] Updating github-config --- .github/workflows/approve-bot-pr.yml | 62 +++++++++++++++++++++++++ .github/workflows/test-pull-request.yml | 33 ------------- 2 files changed, 62 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/approve-bot-pr.yml diff --git a/.github/workflows/approve-bot-pr.yml b/.github/workflows/approve-bot-pr.yml new file mode 100644 index 0000000..2db0852 --- /dev/null +++ b/.github/workflows/approve-bot-pr.yml @@ -0,0 +1,62 @@ +name: Approve Bot PRs + +on: + workflow_run: + workflows: ["Test Pull Request"] + types: + - completed + +jobs: + download: + name: Download PR Artifact + if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + outputs: + pr-author: ${{ steps.pr-data.outputs.author }} + pr-number: ${{ steps.pr-data.outputs.number }} + steps: + - name: 'Download artifact' + uses: paketo-buildpacks/github-config/actions/pull-request/download-artifact@main + with: + name: "event-payload" + repo: ${{ github.repository }} + run_id: ${{ github.event.workflow_run.id }} + workspace: "/github/workspace" + token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} + - id: pr-data + run: | + echo "::set-output name=author::$(cat event.json | jq -r '.pull_request.user.login')" + echo "::set-output name=number::$(cat event.json | jq -r '.pull_request.number')" + + approve: + name: Approve Bot PRs + needs: download + if: ${{ needs.download.outputs.pr-author == 'paketo-bot' || needs.download.outputs.pr-author == 'dependabot[bot]' }} + runs-on: ubuntu-latest + steps: + - name: Check Commit Verification + id: unverified-commits + uses: paketo-buildpacks/github-config/actions/pull-request/check-unverified-commits@main + with: + token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }} + repo: ${{ github.repository }} + number: ${{ needs.download.outputs.pr-number }} + + - name: Check for Human Commits + id: human-commits + uses: paketo-buildpacks/github-config/actions/pull-request/check-human-commits@main + with: + token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }} + repo: ${{ github.repository }} + number: ${{ needs.download.outputs.pr-number }} + + - name: Checkout + if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false' + uses: actions/checkout@v2 + + - name: Approve + if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false' + uses: paketo-buildpacks/github-config/actions/pull-request/approve@main + with: + token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }} + number: ${{ needs.download.outputs.pr-number }} diff --git a/.github/workflows/test-pull-request.yml b/.github/workflows/test-pull-request.yml index 884c10b..11eda32 100644 --- a/.github/workflows/test-pull-request.yml +++ b/.github/workflows/test-pull-request.yml @@ -50,36 +50,3 @@ jobs: with: name: event-payload path: ${{ github.event_path }} - - approve: - name: Approve Bot PRs - if: ${{ github.event.pull_request.user.login == 'paketo-bot' || github.event.pull_request.user.login == 'dependabot[bot]' }} - runs-on: ubuntu-latest - needs: integration - steps: - - name: Check Commit Verification - id: unverified-commits - uses: paketo-buildpacks/github-config/actions/pull-request/check-unverified-commits@main - with: - token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }} - repo: ${{ github.repository }} - number: ${{ github.event.number }} - - - name: Check for Human Commits - id: human-commits - uses: paketo-buildpacks/github-config/actions/pull-request/check-human-commits@main - with: - token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }} - repo: ${{ github.repository }} - number: ${{ github.event.number }} - - - name: Checkout - if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false' - uses: actions/checkout@v2 - - - name: Approve - if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false' - uses: paketo-buildpacks/github-config/actions/pull-request/approve@main - with: - token: ${{ secrets.PAKETO_BOT_REVIEWER_GITHUB_TOKEN }} - number: ${{ github.event.number }}