Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 96 additions & 0 deletions .github/workflows/test-sticky-comment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
name: Test sticky-comment

on:
pull_request:

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

permissions: {}

jobs:
pre-job:
runs-on: ubuntu-latest
permissions:
contents: read
outputs:
should_run: ${{ steps.check.outputs.should_run }}
steps:
- name: Check what should run
id: check
uses: immich-app/devtools/actions/pre-job@91f342bb4477c4bc10c576ae739da875d85aa164 # pre-job-action-v2.0.4
with:
github-token: ${{ github.token }}
filters: |
sticky_comment:
- 'actions/sticky-comment/**'
force-filters: |
- '.github/workflows/test-sticky-comment.yml'

build-check:
name: Verify dist is up to date
needs: pre-job
if: ${{ fromJSON(needs.pre-job.outputs.should_run).sticky_comment == true }}
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
working-directory: ./actions/sticky-comment
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Setup Node
uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
with:
node-version-file: './actions/sticky-comment/.nvmrc'

- run: npm ci
- run: npm run check
- run: npm run build

- name: Verify dist/ matches source
working-directory: .
run: |
if ! git diff --exit-code actions/sticky-comment/dist; then
echo "::error::dist/ is out of date. Run 'npm run build' in actions/sticky-comment and commit the result."
exit 1
fi

smoke:
name: Smoke test
needs: pre-job
if: ${{ fromJSON(needs.pre-job.outputs.should_run).sticky_comment == true && !github.event.pull_request.head.repo.fork }}
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- name: Checkout code
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
with:
persist-credentials: false

- name: Pre-clean (exercise delete path)
uses: ./actions/sticky-comment
with:
id: smoke-test
delete: true

- name: Create comment (exercise create path)
uses: ./actions/sticky-comment
with:
id: smoke-test
body: |
Smoke test for sticky-comment action — created by run ${{ github.run_id }}.

- name: Update comment (exercise update path)
uses: ./actions/sticky-comment
with:
id: smoke-test
body: |
✅ Smoke test for sticky-comment action passed — run ${{ github.run_id }}.
3 changes: 2 additions & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
"services/outline-role-sync": "1.0.0",
".github/workflows": "2.4.0",
"actions/pre-job": "2.0.4",
"actions/create-workflow-token": "2.0.0"
"actions/create-workflow-token": "2.0.0",
"actions/sticky-comment": "0.0.0"
}
1 change: 1 addition & 0 deletions actions/sticky-comment/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules/
1 change: 1 addition & 0 deletions actions/sticky-comment/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
24.15.0
1 change: 1 addition & 0 deletions actions/sticky-comment/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Changelog
25 changes: 25 additions & 0 deletions actions/sticky-comment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'Sticky Comment'
description: 'Maintain a single comment on a PR or issue, keyed by id.'

inputs:
id:
description: 'Unique identifier for this sticky comment. Multiple ids can coexist on the same PR/issue.'
required: true
body:
description: 'Comment body. Required unless `delete` is true.'
required: false
delete:
description: 'If true, delete all matching comments and ignore `body`.'
required: false
default: 'false'
number:
description: 'Issue or PR number. Defaults to the number from the triggering event payload.'
required: false
token:
description: 'GitHub token used for API calls.'
required: false
default: ${{ github.token }}

runs:
using: 'node24'
main: 'dist/index.js'
Loading
Loading