Simplify post-comment to a single set-comment mode

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Mario Campos
2026-10-28 16:00:37 -05:00
parent ae23865548
commit 94488778fd
4 changed files with 76 additions and 160 deletions

View File

@@ -1,17 +1,14 @@
name: "Post comment"
description: "Create, update, or delete a sticky PR comment identified by a caller-provided marker."
description: "Create or update a sticky PR comment identified by a caller-provided marker."
inputs:
marker:
description: "Non-empty marker identifying the comment. Use a unique, stable HTML comment for each distinct comment."
required: true
body:
description: "Full comment markdown. Not needed when deleting a comment."
required: false
action:
description: "Action to perform. One of: none, insert, upsert, delete."
description: "Full comment markdown."
required: true
issue-id:
description: "The issue or pull request number to post/update/delete the comment on. Defaults to the current pull request if not provided."
description: "The issue or pull request number to post/update the comment on. Defaults to the current pull request if not provided."
required: false
token:
description: "The GitHub token to authenticate with."
@@ -26,11 +23,9 @@ runs:
MARKER: ${{ inputs.marker }}
GH_TOKEN: ${{ inputs.token }}
ISSUE_ID: ${{ inputs.issue-id || github.event.pull_request.number }}
ACTION: ${{ inputs.action }}
run: |
npx tsx ./pr-checks/post-comment.ts \
--body "$BODY" \
--marker "$MARKER" \
--action "$ACTION" \
--issue-id "$ISSUE_ID" \
--repository "$GITHUB_REPOSITORY"

View File

@@ -305,11 +305,10 @@ jobs:
Instead, create a change-note file in `unreleased-change-notes/`. The `CHANGELOG.md`
file will be automatically generated from those change-notes.
See [`unreleased-change-notes/README.md`](https://github.com/github/codeql-action/blob/main/unreleased-change-notes/README.md) for more information.
action: upsert
token: ${{ secrets.GITHUB_TOKEN }}
- name: Delete the warning about modifying CHANGELOG.md
id: delete-changelog-warning
- name: Mark the CHANGELOG.md concern as resolved
id: resolve-changelog-warning
if: >-
needs.other-checks.outputs.changelog-changed != 'true' &&
!startsWith(github.event.pull_request.head.ref, 'update-v') &&
@@ -319,5 +318,11 @@ jobs:
uses: ./.github/actions/post-comment
with:
marker: "<!-- post-comment:CHANGELOG.md -->"
action: delete
body: |
⚠️ `CHANGELOG.md` has been modified in this PR. Please do not modify `CHANGELOG.md` directly.
Instead, create a change-note file in `unreleased-change-notes/`. The `CHANGELOG.md`
file will be automatically generated from those change-notes.
See [`unreleased-change-notes/README.md`](https://github.com/github/codeql-action/blob/main/unreleased-change-notes/README.md) for more information.
**Edit:** `CHANGELOG.md` is no longer modified in this PR. This concern is resolved.
token: ${{ secrets.GITHUB_TOKEN }}