From 0a5c9c3cf01b623db650140c761adcd6c7c4e26b Mon Sep 17 00:00:00 2001 From: Darius Jahandarie Date: Sun, 20 Aug 2023 19:19:02 +0900 Subject: Auto-approve safe PRs --- .github/workflows/auto-approve.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/workflows/auto-approve.yml (limited to '.github') diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml new file mode 100644 index 00000000..05523ae3 --- /dev/null +++ b/.github/workflows/auto-approve.yml @@ -0,0 +1,15 @@ +name: Auto-Approve Safe PRs + +on: pull_request_target + +jobs: + auto-approve: + runs-on: ubuntu-latest + environment: themoeway-bot + permissions: + pull-requests: write + if: github.actor == 'djahandarie' + steps: + - uses: hmarr/auto-approve-action@44888193675f29a83e04faf4002fa8c0b537b1e4 # v3.2.1 + with: + github-token: ${{ secrets.THEMOEWAY_BOT_PAT }} -- cgit v1.2.3 From 032599f8c1c344c5592c5562029d98c6ed869c4d Mon Sep 17 00:00:00 2001 From: Darius Jahandarie Date: Sun, 20 Aug 2023 20:27:43 +0900 Subject: Fix auto-approval CI workflow --- .github/workflows/auto-approve-run.yml | 29 +++++++++++++++++++++++++++++ .github/workflows/auto-approve.yml | 19 ++++++++++--------- 2 files changed, 39 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/auto-approve-run.yml (limited to '.github') diff --git a/.github/workflows/auto-approve-run.yml b/.github/workflows/auto-approve-run.yml new file mode 100644 index 00000000..e0605a42 --- /dev/null +++ b/.github/workflows/auto-approve-run.yml @@ -0,0 +1,29 @@ +name: Auto-Approve Safe PRs (workflow-run) +on: + workflow_run: + workflows: [Auto-Approve Safe PRs] + types: + - completed +jobs: + auto-approve-run: + runs-on: ubuntu-latest + environment: themoeway-bot + permissions: + pull-requests: write + if: github.actor == 'djahandarie' + steps: + - name: Download workflow artifact + uses: dawidd6/action-download-artifact@246dbf436b23d7c49e21a7ab8204ca9ecd1fe615 # v2.27.0 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + workflow: auto-approve.yml + run_id: ${{ github.event.workflow_run.id }} + - name: Read the pr_num file + id: pr_num_reader + uses: juliangruber/read-file-action@02bbba9876a8f870efd4ad64e3b9088d3fb94d4b # v1.1.6 + with: + path: ./pr_num/pr_num.txt + - uses: hmarr/auto-approve-action@44888193675f29a83e04faf4002fa8c0b537b1e4 # v3.2.1 + with: + pull-request-number: ${{ steps.pr_num_reader.outputs.content }} + github-token: ${{ secrets.THEMOEWAY_BOT_PAT }} diff --git a/.github/workflows/auto-approve.yml b/.github/workflows/auto-approve.yml index 05523ae3..5dd3831d 100644 --- a/.github/workflows/auto-approve.yml +++ b/.github/workflows/auto-approve.yml @@ -1,15 +1,16 @@ name: Auto-Approve Safe PRs - -on: pull_request_target - +on: pull_request jobs: auto-approve: runs-on: ubuntu-latest - environment: themoeway-bot - permissions: - pull-requests: write - if: github.actor == 'djahandarie' steps: - - uses: hmarr/auto-approve-action@44888193675f29a83e04faf4002fa8c0b537b1e4 # v3.2.1 + - name: Save the PR number in an artifact + shell: bash + env: + PR_NUM: ${{ github.event.number }} + run: echo $PR_NUM > pr_num.txt + - name: Upload the PR number + uses: actions/upload-artifact@v2 with: - github-token: ${{ secrets.THEMOEWAY_BOT_PAT }} + name: pr_num + path: ./pr_num.txt \ No newline at end of file -- cgit v1.2.3