From dfe691f78afa31909e82ae22ae299c2016913126 Mon Sep 17 00:00:00 2001 From: Jacob Bolda Date: Wed, 26 Jun 2024 13:39:22 -0500 Subject: [PATCH] Enable Change Comments On Fork-based PRs (#946) --- .../workflows/covector-comment-on-fork.yml | 28 +++++++++++++++++++ .github/workflows/covector-status.yml | 9 +++--- 2 files changed, 33 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/covector-comment-on-fork.yml diff --git a/.github/workflows/covector-comment-on-fork.yml b/.github/workflows/covector-comment-on-fork.yml new file mode 100644 index 000000000..7cf061321 --- /dev/null +++ b/.github/workflows/covector-comment-on-fork.yml @@ -0,0 +1,28 @@ +name: covector comment +on: + workflow_run: + workflows: [covector status] # the `name` of the workflow run on `pull_request` running `status` with `comment: true` + types: + - completed + +# note all other permissions are set to none if not specified +# and these set the permissions for `secrets.GITHUB_TOKEN` +permissions: + # to read the action artifacts on `covector status` workflows + actions: read + # to write the comment + pull-requests: write + +jobs: + download: + runs-on: ubuntu-latest + if: github.event.workflow_run.conclusion == 'success' && + (github.event.workflow_run.head_repository.full_name != github.repository || github.actor == 'dependabot[bot]') + steps: + - name: covector status + # note we are using the release branch temporarily awaiting a publish of these versions: https://github.com/jbolda/covector/pull/317 + # those changes include updates to support commenting from forks + uses: jbolda/covector/packages/action@release + with: + token: ${{ secrets.GITHUB_TOKEN }} + command: "status" diff --git a/.github/workflows/covector-status.yml b/.github/workflows/covector-status.yml index 6539aa46f..aa585cd88 100644 --- a/.github/workflows/covector-status.yml +++ b/.github/workflows/covector-status.yml @@ -10,9 +10,10 @@ jobs: with: fetch-depth: 0 - name: covector status - uses: jbolda/covector/packages/action@covector-v0 - id: covector + # note we are using the release branch temporarily awaiting a publish of these versions: https://github.com/jbolda/covector/pull/317 + # those changes include updates to support commenting from forks + uses: jbolda/covector/packages/action@release with: - command: 'status' + command: "status" token: ${{ secrets.GITHUB_TOKEN }} - comment: true \ No newline at end of file + comment: true