Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4e0ff1f
ci: replace marocchino/sticky-pull-request-comment by gh cli
rjaegers Oct 6, 2025
c386164
ci: update comments
rjaegers Oct 6, 2025
4a13d40
ci: remove social-interaction workflow
rjaegers Oct 6, 2025
dba12f6
Update .github/workflows/pr-conventional-title.yml
rjaegers Oct 6, 2025
ef6036e
chore: fix issues identified in workflow
rjaegers Oct 6, 2025
880c891
ci: refactor to re-usable workflow
rjaegers Oct 6, 2025
0bc63b6
chore: process more review feedback
rjaegers Oct 6, 2025
0fdad3a
style: add yaml start token
rjaegers Oct 6, 2025
642f0af
chore: apply review comments
rjaegers Oct 6, 2025
81a4527
chore: add checkout action
rjaegers Oct 6, 2025
0d64ddf
chore: restore after failed experiment
rjaegers Oct 6, 2025
a99e6e6
chore: remove more fall-out
rjaegers Oct 6, 2025
dcf4ad4
ci: least privilege and add documentation
rjaegers Oct 6, 2025
61945f8
ci: fix out of date version comment
rjaegers Oct 6, 2025
bebaa47
ci: fix more zizmor findings
rjaegers Oct 6, 2025
615187b
chore: fix more zizmor findings
rjaegers Oct 10, 2025
a24c3e1
Merge commit 'c95553700f0bc0441f25acb4268840fbd6e2733c' into ci/harde…
rjaegers Oct 22, 2025
8e5a5dd
Apply suggestion from @Copilot
rjaegers Oct 22, 2025
f0fbc35
ci: add cooldown to dependabot
rjaegers Oct 22, 2025
262644d
ci: document permissions
rjaegers Oct 22, 2025
457b2c0
Merge branch 'main' into ci/harden-action-security
rjaegers Oct 24, 2025
89ed11d
chore: fix more findings
rjaegers Oct 24, 2025
e098064
chore: document all permissions
rjaegers Oct 27, 2025
87e46a6
chore: fix template injection possibility
rjaegers Oct 27, 2025
3e271c9
Merge branch 'main' into ci/harden-action-security
rjaegers Oct 27, 2025
b387a42
Merge branch 'main' into ci/harden-action-security
rjaegers Oct 27, 2025
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
91 changes: 91 additions & 0 deletions .github/actions/sticky-pr-comment/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
name: 'Sticky PR Comment'
description: 'Creates, updates or deletes a PR comment identified by a hidden marker'
branding:
icon: message-circle
color: blue

inputs:
pr-number:
description: 'Pull request number'
required: true
body:
description: 'Comment body content (without marker) to upsert. Required unless mode=delete.'
required: false
marker:
description: 'Unique hidden marker to identify the sticky comment'
default: 'sticky-comment'
required: false
mode:
description: 'Operation mode: upsert or delete'
default: 'upsert'
required: false

runs:
using: 'composite'
steps:
- name: Validate inputs
env:
MODE: ${{ inputs.mode }}
BODY: ${{ inputs.body }}
shell: bash
run: |
set -Eeuo pipefail

case "${MODE}" in
upsert|delete) ;;
*) echo "Invalid mode: ${MODE} (expected upsert|delete)" >&2; exit 1;;
esac

if [ "${MODE}" = delete ]; then
Comment thread
rjaegers marked this conversation as resolved.
Outdated
exit 0
fi

if [ -z "${BODY}" ]; then
echo 'Input "body" is required in upsert mode' >&2
exit 1
fi
- name: Upsert comment
if: inputs.mode == 'upsert'
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ inputs.pr-number }}
MARKER: ${{ inputs.marker }}
BODY: ${{ inputs.body }}
shell: bash
run: |
set -Eeuo pipefail

MARKER_COMMENT="<!-- ${MARKER} -->"
FULL_BODY=$(printf "%s\n%s" "${MARKER_COMMENT}" "${BODY}")
EXISTING_ID=$(gh api "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" --jq ".[] | select(.body|contains(\"${MARKER_COMMENT}\")) | .id" | head -n1 || true)
Comment thread
rjaegers marked this conversation as resolved.
Outdated

if [ -n "${EXISTING_ID}" ]; then
echo "Updating existing sticky comment (${EXISTING_ID})"
gh api "repos/${GITHUB_REPOSITORY}/issues/comments/${EXISTING_ID}" -X PATCH -f body="${FULL_BODY}"
Comment thread
rjaegers marked this conversation as resolved.
Outdated
else
echo "Creating new sticky comment"
gh api "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" -f body="${FULL_BODY}"
Comment thread
rjaegers marked this conversation as resolved.
Outdated
Comment thread
rjaegers marked this conversation as resolved.
Outdated
fi
- name: Delete comment(s)
if: inputs.mode == 'delete'
env:
GH_TOKEN: ${{ github.token }}
PR_NUMBER: ${{ inputs.pr-number }}
MARKER: ${{ inputs.marker }}
shell: bash
run: |
set -Eeuo pipefail

MARKER_COMMENT="<!-- ${MARKER} -->"
FOUND_IDS=$(gh api "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" --jq ".[] | select(.body|contains(\"${MARKER_COMMENT}\")) | .id" || true)
Comment thread
rjaegers marked this conversation as resolved.
Outdated

if [ -z "${FOUND_IDS}" ]; then
echo "No sticky comment(s) to delete";
exit 0;
fi

for id in ${FOUND_IDS}; do
echo "Deleting sticky comment $id"
gh api "repos/${GITHUB_REPOSITORY}/issues/comments/${id}" -X DELETE
done
23 changes: 15 additions & 8 deletions .github/workflows/pr-conventional-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
validate-pr-title:
runs-on: ubuntu-latest
permissions:
# We need `contents: read` to be able to use the local GitHub Action
contents: read
# We need `pull-requests: write` to be able to post comments on PRs
pull-requests: write
steps:
- uses: step-security/harden-runner@f4a75cfd619ee5ce8d5b864b0d183aff3c69b55a # v2.13.1
Expand All @@ -32,21 +35,25 @@ jobs:
doesn't start with an uppercase character.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
persist-credentials: false
- uses: ./.github/actions/sticky-pr-comment
if: always() && steps.pr-title.outputs.error_message != null
with:
header: pr-title-lint-error
message: |
pr-number: ${{ github.event.pull_request.number }}
marker: pr-title-lint-error
body: |
Hey there and thank you for opening this pull request! 👋🏼

We require pull request titles to follow the [Conventional Commits specification](https://www.conventionalcommits.org/en/v1.0.0/) and it looks like your proposed title needs to be adjusted.

:warning: Details

${{ steps.pr-title.outputs.error_message }}

- if: steps.pr-title.outputs.error_message == null
uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
- uses: ./.github/actions/sticky-pr-comment
if: steps.pr-title.outputs.error_message == null
with:
header: pr-title-lint-error
delete: true
pr-number: ${{ github.event.pull_request.number }}
marker: pr-title-lint-error
mode: delete
31 changes: 0 additions & 31 deletions .github/workflows/social-interaction.yml

This file was deleted.

7 changes: 4 additions & 3 deletions .github/workflows/wc-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,11 @@ jobs:
with:
from-container: ${{ env.REGISTRY }}/${{ github.repository }}-${{ inputs.flavor }}:edge
to-container: ${{ env.REGISTRY }}/${{ github.repository }}-${{ inputs.flavor }}:${{ steps.metadata.outputs.version }}
- uses: marocchino/sticky-pull-request-comment@773744901bac0e8cbb5a0dc842800d45e9b2b405 # v2.9.4
- uses: ./.github/actions/sticky-pr-comment
with:
header: container-size-diff-${{ inputs.flavor }}
message: |
pr-number: ${{ github.event.pull_request.number }}
marker: container-size-diff-${{ inputs.flavor }}
body: |
${{ steps.container-size-diff.outputs.size-diff-markdown }}
- uses: anchore/sbom-action@f8bdd1d8ac5e901a77a92f111440fdb1b593736b # v0.20.6
with:
Expand Down
Loading