Skip to content

Commit d0df3d2

Browse files
File sync from hanakai-rb/repo-sync
Updated files: - .github/workflows/ci.yml - .github/workflows/pr-comments.yml
1 parent 7c2d009 commit d0df3d2

File tree

2 files changed

+39
-7
lines changed

2 files changed

+39
-7
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ on:
1414
jobs:
1515
tests:
1616
name: Tests (Ruby ${{ matrix.ruby }})
17-
permissions:
18-
pull-requests: write
1917
runs-on: ubuntu-latest
2018
continue-on-error: ${{ matrix.optional || false }}
2119
strategy:
@@ -55,13 +53,14 @@ jobs:
5553
exit 0 # Ignore error here to keep the green checkmark
5654
fi
5755
exit ${status}
58-
- name: Add comment for optional failures
59-
uses: thollander/actions-comment-pull-request@v3
56+
- name: Create optional failure comment
6057
if: ${{ matrix.optional && github.event.pull_request }}
58+
uses: hanakai-rb/repo-sync/pr-comment-artifact@main
6159
with:
62-
comment-tag: "${{ matrix.ruby }}-optional-failure-notice"
63-
message: |
64-
ℹ️ Optional job failed: Ruby ${{ matrix.ruby }}
60+
name: ci-ruby-${{ matrix.ruby }}
61+
pr-number: ${{ github.event.pull_request.number }}
62+
comment-tag: ruby-${{ matrix.ruby }}-optional-failure
63+
message: "ℹ️ Optional job failed: Ruby ${{ matrix.ruby }}"
6564
mode: ${{ steps.test.outputs.optional_fail == 'true' && 'upsert' || 'delete' }}
6665

6766
workflow-keepalive:

.github/workflows/pr-comments.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# frozen_string_literal: true
2+
3+
# This file is synced from hanakai-rb/repo-sync
4+
5+
# Downloads comment artifacts from completed workflows and posts them to PRs. This allows source
6+
# workflows to run with read-only permissions on fork PRs while still posting comments via this
7+
# privileged workflow that runs in the base repo context.
8+
#
9+
# Comment artifacts should be generated using the `hanakai-rb/repo-sync/pr-comment-artifact@main`
10+
# action.
11+
12+
name: PR comments
13+
14+
on:
15+
workflow_run:
16+
workflows: ["CI"]
17+
types:
18+
- completed
19+
20+
permissions:
21+
pull-requests: write
22+
23+
jobs:
24+
post-comments:
25+
runs-on: ubuntu-latest
26+
if: github.event.workflow_run.event == "pull_request"
27+
28+
steps:
29+
- name: Post comments
30+
uses: hanakai-rb/repo-sync/pr-comments-from-artifacts@main
31+
with:
32+
workflow-run-id: ${{ github.event.workflow_run.id }}
33+
github-token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)