Skip to content

Commit 7d5afa4

Browse files
authored
feat: sticky-comment action (#1613)
1 parent 1d65f08 commit 7d5afa4

14 files changed

Lines changed: 37512 additions & 2 deletions
Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
name: Test sticky-comment
2+
3+
on:
4+
pull_request:
5+
6+
concurrency:
7+
group: ${{ github.workflow }}-${{ github.ref }}
8+
cancel-in-progress: true
9+
10+
permissions: {}
11+
12+
jobs:
13+
pre-job:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
outputs:
18+
should_run: ${{ steps.check.outputs.should_run }}
19+
steps:
20+
- name: Check what should run
21+
id: check
22+
uses: immich-app/devtools/actions/pre-job@91f342bb4477c4bc10c576ae739da875d85aa164 # pre-job-action-v2.0.4
23+
with:
24+
github-token: ${{ github.token }}
25+
filters: |
26+
sticky_comment:
27+
- 'actions/sticky-comment/**'
28+
force-filters: |
29+
- '.github/workflows/test-sticky-comment.yml'
30+
31+
build-check:
32+
name: Verify dist is up to date
33+
needs: pre-job
34+
if: ${{ fromJSON(needs.pre-job.outputs.should_run).sticky_comment == true }}
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: read
38+
defaults:
39+
run:
40+
working-directory: ./actions/sticky-comment
41+
steps:
42+
- name: Checkout code
43+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
44+
with:
45+
persist-credentials: false
46+
47+
- name: Setup Node
48+
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
49+
with:
50+
node-version-file: './actions/sticky-comment/.nvmrc'
51+
52+
- run: npm ci
53+
- run: npm run check
54+
- run: npm run build
55+
56+
- name: Verify dist/ matches source
57+
working-directory: .
58+
run: |
59+
if ! git diff --exit-code actions/sticky-comment/dist; then
60+
echo "::error::dist/ is out of date. Run 'npm run build' in actions/sticky-comment and commit the result."
61+
exit 1
62+
fi
63+
64+
smoke:
65+
name: Smoke test
66+
needs: pre-job
67+
if: ${{ fromJSON(needs.pre-job.outputs.should_run).sticky_comment == true && !github.event.pull_request.head.repo.fork }}
68+
runs-on: ubuntu-latest
69+
permissions:
70+
contents: read
71+
pull-requests: write
72+
steps:
73+
- name: Checkout code
74+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
75+
with:
76+
persist-credentials: false
77+
78+
- name: Pre-clean (exercise delete path)
79+
uses: ./actions/sticky-comment
80+
with:
81+
id: smoke-test
82+
delete: true
83+
84+
- name: Create comment (exercise create path)
85+
uses: ./actions/sticky-comment
86+
with:
87+
id: smoke-test
88+
body: |
89+
Smoke test for sticky-comment action — created by run ${{ github.run_id }}.
90+
91+
- name: Update comment (exercise update path)
92+
uses: ./actions/sticky-comment
93+
with:
94+
id: smoke-test
95+
body: |
96+
✅ Smoke test for sticky-comment action passed — run ${{ github.run_id }}.

.release-please-manifest.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,6 @@
55
"services/outline-role-sync": "1.0.0",
66
".github/workflows": "2.4.0",
77
"actions/pre-job": "2.0.4",
8-
"actions/create-workflow-token": "2.0.0"
8+
"actions/create-workflow-token": "2.0.0",
9+
"actions/sticky-comment": "0.0.0"
910
}

actions/sticky-comment/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
node_modules/

actions/sticky-comment/.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
24.15.0
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Changelog

actions/sticky-comment/action.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: 'Sticky Comment'
2+
description: 'Maintain a single comment on a PR or issue, keyed by id.'
3+
4+
inputs:
5+
id:
6+
description: 'Unique identifier for this sticky comment. Multiple ids can coexist on the same PR/issue.'
7+
required: true
8+
body:
9+
description: 'Comment body. Required unless `delete` is true.'
10+
required: false
11+
delete:
12+
description: 'If true, delete all matching comments and ignore `body`.'
13+
required: false
14+
default: 'false'
15+
number:
16+
description: 'Issue or PR number. Defaults to the number from the triggering event payload.'
17+
required: false
18+
token:
19+
description: 'GitHub token used for API calls.'
20+
required: false
21+
default: ${{ github.token }}
22+
23+
runs:
24+
using: 'node24'
25+
main: 'dist/index.js'

0 commit comments

Comments
 (0)