mirror of
https://github.com/jlengrand/error-prone-support.git
synced 2026-03-10 08:11:25 +00:00
57 lines
2.2 KiB
YAML
57 lines
2.2 KiB
YAML
# Description: This workflow is triggered when the `receive-pr` workflow completes to post suggestions on the PR.
|
|
# Since this pull request has write permissions on the target repo, we should **NOT** execute any untrusted code.
|
|
# https://securitylab.github.com/research/github-actions-preventing-pwn-requests/
|
|
---
|
|
name: comment-pr
|
|
|
|
on:
|
|
workflow_run:
|
|
workflows: ["receive-pr"]
|
|
types:
|
|
- completed
|
|
|
|
jobs:
|
|
post-suggestions:
|
|
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#running-a-workflow-based-on-the-conclusion-of-another-workflow
|
|
if: ${{ github.event.workflow_run.conclusion == 'success' }}
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
# https://docs.github.com/en/actions/reference/authentication-in-a-workflow#permissions-for-the-github_token
|
|
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
timeout-minutes: 10
|
|
steps:
|
|
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
with:
|
|
ref: ${{github.event.workflow_run.head_branch}}
|
|
repository: ${{github.event.workflow_run.head_repository.full_name}}
|
|
|
|
- name: Download the patch.
|
|
uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe # v3.1.4
|
|
with:
|
|
name: patch
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
run-id: ${{ github.event.workflow_run.id }}
|
|
- name: Apply patch
|
|
run: |
|
|
git apply git-diff.patch --allow-empty
|
|
rm git-diff.patch
|
|
|
|
- name: Download the PR number.
|
|
uses: dawidd6/action-download-artifact@09f2f74827fd3a8607589e5ad7f9398816f540fe # v3.1.4
|
|
with:
|
|
name: pr_number
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
run-id: ${{ github.event.workflow_run.id }}
|
|
- name: Read pr_number.txt
|
|
run: |
|
|
PR_NUMBER=$(cat pr_number.txt)
|
|
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV
|
|
rm pr_number.txt
|
|
|
|
- name: Post suggestions as a comment on the PR.
|
|
uses: googleapis/code-suggester@589b3ac11ac2575fd561afa45034907f301a375b # v3.4.4
|
|
with:
|
|
command: review
|
|
pull_number: ${{ env.PR_NUMBER }}
|
|
git_dir: '.'
|