-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (41 loc) · 1.81 KB
/
add-pr-comment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Comment on Every Pull Request
on: [push, pull_request]
# NOTE: This is possibly insecure; it allows Dependabot to comment on a PR, the point of this run.
# @see: https://github.blog/changelog/2021-10-06-github-actions-workflows-triggered-by-dependabot-prs-will-respect-permissions-key-in-workflows/
permissions:
pull-requests: write
jobs:
add-pr-comment:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Find Pull Request
id: find-pr
uses: ./ # run against self
with:
failIfNotFound: ${{ github.event_name == 'pull_request' }} # Fail for a PR, not for a push
# Do not debug the body as it will break things!
- name: Debug
run: |
echo number: ${{ steps.find-pr.outputs.number }}
echo url: ${{ steps.find-pr.outputs.url }}
echo title: ${{ steps.find-pr.outputs.title }}
echo base-ref: ${{ steps.find-pr.outputs.base-ref }}
echo base-sha: ${{ steps.find-pr.outputs.base-sha }}
- name: Comment on the found Pull Request
if: steps.find-pr.outputs.number != ''
uses: marocchino/sticky-pull-request-comment@v2
with:
header: comment # basically a key to reuse the same comment
number: ${{ steps.find-pr.outputs.number }}
message: |
:tada: I added a comment!
- number: ${{ steps.find-pr.outputs.number }}
- url: ${{ steps.find-pr.outputs.url }}
- title: ${{ steps.find-pr.outputs.title }}
- base-ref: ${{ steps.find-pr.outputs.base-ref }}
- base-sha: ${{ steps.find-pr.outputs.base-sha }}
<details>
<summary>click to view body</summary>
${{ steps.find-pr.outputs.body }}
</details>