From c3ec9fdf84d2526c7906a5f433541027f33cfd1d Mon Sep 17 00:00:00 2001 From: Cyprien Pelisse-Verdoux Date: Fri, 19 Jun 2026 11:50:58 +0200 Subject: [PATCH 1/3] feat(ci): add build of alumet artefact on each PR --- .github/workflows/build_docker.yaml | 50 ++++++- .github/workflows/pr_check.yaml | 207 ++++++++++++++++++++++++++++ 2 files changed, 256 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/pr_check.yaml diff --git a/.github/workflows/build_docker.yaml b/.github/workflows/build_docker.yaml index 485a1fdc..93eecc08 100644 --- a/.github/workflows/build_docker.yaml +++ b/.github/workflows/build_docker.yaml @@ -16,6 +16,16 @@ on: required: true type: string + build_rpm: + type: boolean + required: false + default: true + + build_deb: + type: boolean + required: false + default: true + jobs: packaging: name: packaging (${{ matrix.os.name }}) @@ -37,19 +47,32 @@ jobs: - { name: ubuntu_24.04, type: deb, path: "docker/ubuntu", base-image: ubuntu:24.04 } steps: + - name: Skip non relevant builds + id: gate + run: | + if [[ "${{ matrix.os.type }}" == "rpm" && "${{ inputs.build_rpm }}" != "true" ]]; then + echo "skip=true" >> $GITHUB_OUTPUT + elif [[ "${{ matrix.os.type }}" == "deb" && "${{ inputs.build_deb }}" != "true" ]]; then + echo "skip=true" >> $GITHUB_OUTPUT + else + echo "skip=false" >> $GITHUB_OUTPUT + fi # See deb and rpm steps. - name: Normalize version number + if: steps.gate.outputs.skip != 'true' run: | export PKG_VERSION=$(echo ${{ inputs.version }} | sed 's/[_-]/~/g') echo "PKG_VERSION=$PKG_VERSION" >> $GITHUB_ENV echo "PKG_VERSION=$PKG_VERSION" - name: Checkout the repository + if: steps.gate.outputs.skip != 'true' uses: actions/checkout@v4 with: repository: alumet-dev/packaging - name: Define the dependency artifact name (RPM) + if: steps.gate.outputs.skip != 'true' run: | if [[ ${{ matrix.os.type }} == 'rpm' ]]; then echo "DEPS_ARTIFACT_FILE=alumet-agent-${{ env.PKG_VERSION }}-${{ inputs.release-version }}.${{ matrix.os.name }}.${{ env.ARCH }}.rpm" >> $GITHUB_ENV @@ -59,28 +82,35 @@ jobs: - name: Define the output artifact name id: artifact_name + if: steps.gate.outputs.skip != 'true' run: | echo "OUTPUT_ARTIFACT_NAME=alumet-agent-${{ inputs.version }}-${{ inputs.release-version }}.${{ matrix.os.name }}.${{ inputs.arch }}.docker.tar" >> $GITHUB_OUTPUT - name: Create the dependency artifacts directory + if: steps.gate.outputs.skip != 'true' run: mkdir -p build/deps-artifacts - name: Download artifact + if: steps.gate.outputs.skip != 'true' uses: actions/download-artifact@v4 with: name: ${{ env.DEPS_ARTIFACT_FILE }} path: ${{ matrix.os.path }} - name: Create docker image output dir + if: steps.gate.outputs.skip != 'true' run: mkdir -p build/docker - name: Set up QEMU + if: steps.gate.outputs.skip != 'true' uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx + if: steps.gate.outputs.skip != 'true' uses: docker/setup-buildx-action@v3 - name: Set up image tags + if: steps.gate.outputs.skip != 'true' run: | TAGS="ghcr.io/${{ github.repository_owner }}/alumet-agent:${{ inputs.version }}-${{ inputs.release-version }}_${{ matrix.os.name }}_${{ inputs.arch }}" if [ "${{ matrix.os.latest_tag }}" == "true" ]; then @@ -90,6 +120,7 @@ jobs: echo "Images tags: $TAGS" >> $GITHUB_STEP_SUMMARY - name: Build image + if: steps.gate.outputs.skip != 'true' uses: docker/build-push-action@v6 with: context: ${{ matrix.os.path }} @@ -109,6 +140,7 @@ jobs: DOCKER_BUILD_SUMMARY: false - name: Upload docker image artifact + if: steps.gate.outputs.skip != 'true' uses: actions/upload-artifact@v4 with: name: ${{ steps.artifact_name.outputs.OUTPUT_ARTIFACT_NAME }} @@ -127,25 +159,41 @@ jobs: - packaging steps: + - name: Skip non relevant builds + id: gate + run: | + if [[ "${{ matrix.os.type }}" == "rpm" && "${{ inputs.build_rpm }}" != "true" ]]; then + echo "skip=true" >> $GITHUB_OUTPUT + elif [[ "${{ matrix.os.type }}" == "deb" && "${{ inputs.build_deb }}" != "true" ]]; then + echo "skip=true" >> $GITHUB_OUTPUT + else + echo "skip=false" >> $GITHUB_OUTPUT + fi + - name: Checkout the repository + if: steps.gate.outputs.skip != 'true' uses: actions/checkout@v4 with: repository: alumet-dev/packaging - name: Create docker artifacts directory + if: steps.gate.outputs.skip != 'true' run: mkdir docker-artifacts - name: Download docker images artifacts + if: steps.gate.outputs.skip != 'true' uses: actions/download-artifact@v4 with: name: ${{ needs.packaging.outputs.artifact_name }} path: ./docker-artifacts - name: Install Goss / Dgoss + if: steps.gate.outputs.skip != 'true' run: | curl -fsSL https://goss.rocks/install | sh - name: Run Dgoss tests + if: steps.gate.outputs.skip != 'true' run: | image_sha=$(docker load -q -i ./docker-artifacts/${{ needs.packaging.outputs.artifact_name }} | grep "Loaded image: "| awk '{ print $3 }' | head -1) export GOSS_FILE=.github/dgoss_validate.yaml @@ -153,7 +201,7 @@ jobs: dgoss run --cap-add=sys_ptrace --cap-add=perfmon --cap-add=sys_nice $image_sha 2>&1 | tee ${{ matrix.os }}-${{ inputs.arch }}-dgoss_tests_report.txt >> $GITHUB_STEP_SUMMARY - name: Upload tests reports - if: always() # never skip to have file even in case of test failure + if: always() && steps.gate.outputs.run == 'true' # never skip to have file even in case of test failure continue-on-error: true uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/pr_check.yaml b/.github/workflows/pr_check.yaml new file mode 100644 index 00000000..05408b6d --- /dev/null +++ b/.github/workflows/pr_check.yaml @@ -0,0 +1,207 @@ +name: Build Alumet artefacts + +on: + pull_request: + paths: + - ".github/**" + - "deb/**" + - "docker/**" + - "rpm/**" + +permissions: + contents: read + issues: write + pull-requests: write + +concurrency: + group: pr-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + + find-changements: + runs-on: ubuntu-latest + outputs: + run-rpm: ${{ steps.get-modified-files.outputs.rpm }} + run-deb: ${{ steps.get-modified-files.outputs.deb }} + run-all: ${{ steps.get-modified-files.outputs.github }} + steps: + - uses: actions/checkout@v7 + + - id: get-modified-files + uses: dorny/paths-filter@v4 + with: + filters: | + rpm: + - 'rpm/**' + - '!rpm/**/*.md' + - '!rpm/**/.gitignore' + + deb: + - 'deb/**' + - '!deb/**/*.md' + - '!deb/**/.gitignore' + + github: + - '.github/**' + - '!.github/**/*.md' + + setup-input: + runs-on: ubuntu-latest + outputs: + version: ${{ steps.vars.outputs.VERSION}} + revision: ${{ steps.vars.outputs.REVISION }} + steps: + - name: Retrieve build arguments + id: vars + run: | + TAG=$(curl -L https://api.github.com/repos/alumet-dev/alumet/releases/latest | jq -r '.tag_name') + echo "VERSION=${TAG#v}" >> "$GITHUB_OUTPUT" + REF=$(curl -sL "https://api.github.com/repos/alumet-dev/alumet/git/ref/tags/$TAG") + + TYPE=$(echo "$REF" | jq -r '.object.type') + SHA=$(echo "$REF" | jq -r '.object.sha') + + if [ "$TYPE" = "tag" ]; then + SHA=$(curl -sL \ + "https://api.github.com/repos/alumet-dev/alumet/git/tags/$SHA" \ + | jq -r '.object.sha') + fi + echo "REVISION=pr${{ github.event.pull_request.number }}SHA${SHA}" >> "$GITHUB_OUTPUT" + + rpm: + uses: ./.github/workflows/build_rpm.yaml + if: ${{ needs.find-changements.outputs.run-rpm == 'true' || needs.find-changements.outputs.run-all == 'true' }} + strategy: + fail-fast: false + matrix: + arch: [x86_64, aarch64] + needs: + - find-changements + - setup-input + with: + arch: ${{ matrix.arch }} + version: ${{ needs.setup-input.outputs.version }} + release-version: ${{ needs.setup-input.outputs.revision }} + + deb: + uses: ./.github/workflows/build_deb.yaml + if: ${{ needs.find-changements.outputs.run-deb == 'true' || needs.find-changements.outputs.run-all == 'true' }} + strategy: + fail-fast: false + matrix: + arch: [x86_64, aarch64] + needs: + - find-changements + - setup-input + with: + arch: ${{ matrix.arch }} + version: ${{ needs.setup-input.outputs.version }} + revision: ${{ needs.setup-input.outputs.revision }} + + docker: + uses: ./.github/workflows/build_docker.yaml + if: always() && (needs.deb.result == 'success' || needs.rpm.result == 'success') + strategy: + fail-fast: false + matrix: + arch: [x86_64, aarch64] + with: + arch: ${{ matrix.arch }} + version: ${{ needs.setup-input.outputs.version }} + release-version: ${{ needs.setup-input.outputs.revision }} + needs: + - find-changements + - setup-input + - rpm + - deb + + comment-output: + runs-on: ubuntu-latest + env: + ORDER: 'first' #could be 'first' or 'last' + SEARCH_STRING: "🔥 Generated artifacts 🔥" + BODY: "🔥 Generated artifacts 🔥" + FORCE_RECREATE: true + needs: + - setup-input + - rpm + - deb + - docker + steps: + - name: Search for previous comment + id: find-comment + uses: actions/github-script@v9 + with: + script: | + const opts = github.rest.issues.listComments.endpoint.merge({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + }); + + // Paginate is used to retrieve the comments of every pages. + // See https://octokit.github.io/rest.js/v21/#pagination. + var comments = await github.paginate(opts) + + // Reverse comments array if wanted + // (listComments returns the comments ordered by ascending ID). + if (process.env.ORDER === 'last') { + comments.reverse() + } + + // Iterate over the comments array. + for (const comment of comments) { + if (comment.user.login !== 'github-actions[bot]') { + continue + } + + if (comment.body.includes(process.env.SEARCH_STRING)) { + core.setOutput('comment-id', comment.id.toString()) + break + } + } + + - name: Get body + id: get-body + uses: actions/github-script@v9 + with: + script: | + const body = process.env.BODY || ""; + + const runUrl = + `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}` + + `/actions/runs/${context.runId}`; + + const message = ` + ### ${body} + + --- + + Artefacts can be found there: ${runUrl}`; + + core.exportVariable('COMMENT_BODY', message) + + - name: Create a new comment + if: ${{ env.FORCE_RECREATE == 'true' || steps.find-comment.outputs.comment-id == '' }} + uses: actions/github-script@v9 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: process.env.COMMENT_BODY + }) + + - name: Update existing comment + if: ${{ env.FORCE_RECREATE != 'true' && steps.find-comment.outputs.comment-id != '' }} + uses: actions/github-script@v9 + with: + script: | + github.rest.issues.updateComment({ + comment_id: ${{ steps.find-comment.outputs.comment-id }}, + owner: context.repo.owner, + repo: context.repo.repo, + body: process.env.COMMENT_BODY + }) \ No newline at end of file From 3efff81a46ea90a8a59e57d706db52ccecd72265 Mon Sep 17 00:00:00 2001 From: Titouan Jouffray Date: Wed, 24 Jun 2026 14:49:31 +0200 Subject: [PATCH 2/3] ci(build_docker): use matrix exclusion instead --- .github/workflows/build_docker.yaml | 73 ++++++++++++----------------- 1 file changed, 29 insertions(+), 44 deletions(-) diff --git a/.github/workflows/build_docker.yaml b/.github/workflows/build_docker.yaml index 93eecc08..3418d15e 100644 --- a/.github/workflows/build_docker.yaml +++ b/.github/workflows/build_docker.yaml @@ -45,34 +45,30 @@ jobs: - { name: fc43, type: rpm, path: "docker/fedora", base-image: fedora:43 } - { name: debian_13, type: deb, path: "docker/debian" , base-image: debian:13-slim } - { name: ubuntu_24.04, type: deb, path: "docker/ubuntu", base-image: ubuntu:24.04 } + build-rpm: + - ${{ inputs.build_rpm }} + build-deb: + - ${{ inputs.build_deb}} + exclude: + - os: {type: rpm} + build-rpm: false + - os: {type: deb} + build-deb: false steps: - - name: Skip non relevant builds - id: gate - run: | - if [[ "${{ matrix.os.type }}" == "rpm" && "${{ inputs.build_rpm }}" != "true" ]]; then - echo "skip=true" >> $GITHUB_OUTPUT - elif [[ "${{ matrix.os.type }}" == "deb" && "${{ inputs.build_deb }}" != "true" ]]; then - echo "skip=true" >> $GITHUB_OUTPUT - else - echo "skip=false" >> $GITHUB_OUTPUT - fi # See deb and rpm steps. - name: Normalize version number - if: steps.gate.outputs.skip != 'true' run: | export PKG_VERSION=$(echo ${{ inputs.version }} | sed 's/[_-]/~/g') echo "PKG_VERSION=$PKG_VERSION" >> $GITHUB_ENV echo "PKG_VERSION=$PKG_VERSION" - name: Checkout the repository - if: steps.gate.outputs.skip != 'true' uses: actions/checkout@v4 with: repository: alumet-dev/packaging - name: Define the dependency artifact name (RPM) - if: steps.gate.outputs.skip != 'true' run: | if [[ ${{ matrix.os.type }} == 'rpm' ]]; then echo "DEPS_ARTIFACT_FILE=alumet-agent-${{ env.PKG_VERSION }}-${{ inputs.release-version }}.${{ matrix.os.name }}.${{ env.ARCH }}.rpm" >> $GITHUB_ENV @@ -82,35 +78,28 @@ jobs: - name: Define the output artifact name id: artifact_name - if: steps.gate.outputs.skip != 'true' run: | echo "OUTPUT_ARTIFACT_NAME=alumet-agent-${{ inputs.version }}-${{ inputs.release-version }}.${{ matrix.os.name }}.${{ inputs.arch }}.docker.tar" >> $GITHUB_OUTPUT - name: Create the dependency artifacts directory - if: steps.gate.outputs.skip != 'true' run: mkdir -p build/deps-artifacts - name: Download artifact - if: steps.gate.outputs.skip != 'true' uses: actions/download-artifact@v4 with: name: ${{ env.DEPS_ARTIFACT_FILE }} path: ${{ matrix.os.path }} - name: Create docker image output dir - if: steps.gate.outputs.skip != 'true' run: mkdir -p build/docker - name: Set up QEMU - if: steps.gate.outputs.skip != 'true' uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - if: steps.gate.outputs.skip != 'true' uses: docker/setup-buildx-action@v3 - name: Set up image tags - if: steps.gate.outputs.skip != 'true' run: | TAGS="ghcr.io/${{ github.repository_owner }}/alumet-agent:${{ inputs.version }}-${{ inputs.release-version }}_${{ matrix.os.name }}_${{ inputs.arch }}" if [ "${{ matrix.os.latest_tag }}" == "true" ]; then @@ -120,7 +109,6 @@ jobs: echo "Images tags: $TAGS" >> $GITHUB_STEP_SUMMARY - name: Build image - if: steps.gate.outputs.skip != 'true' uses: docker/build-push-action@v6 with: context: ${{ matrix.os.path }} @@ -140,7 +128,6 @@ jobs: DOCKER_BUILD_SUMMARY: false - name: Upload docker image artifact - if: steps.gate.outputs.skip != 'true' uses: actions/upload-artifact@v4 with: name: ${{ steps.artifact_name.outputs.OUTPUT_ARTIFACT_NAME }} @@ -150,60 +137,58 @@ jobs: runs-on: ${{ inputs.arch == 'x86_64' && 'ubuntu-24.04' || inputs.arch == 'aarch64' && 'ubuntu-24.04-arm'}} timeout-minutes: 10 env: - DOCKER_ARTIFACT_NAME: alumet-agent-${{ inputs.version }}-${{ inputs.release-version }}.${{ matrix.os }}.${{ inputs.arch }}.docker.tar + DOCKER_ARTIFACT_NAME: alumet-agent-${{ inputs.version }}-${{ inputs.release-version }}.${{ matrix.os.name }}.${{ inputs.arch }}.docker.tar strategy: fail-fast: false matrix: - os: ["ubi9.6", "ubi10.1", "fc43", "debian_13", "ubuntu_24.04"] + os: + - { name: ubi10.1, type: rpm, path: "docker/ubi", base-image: registry.access.redhat.com/ubi10-micro:10.1, builder-image: registry.access.redhat.com/ubi10:10.1, libssl-version: 3, libcrypto-version: 3, latest_tag: true} + - { name: ubi9.6, type: rpm, path: "docker/ubi", base-image: registry.access.redhat.com/ubi9-micro:9.6, builder-image: registry.access.redhat.com/ubi9:9.6, libssl-version: 3, libcrypto-version: 3, latest_tag: true} + - { name: fc43, type: rpm, path: "docker/fedora", base-image: fedora:43 } + - { name: debian_13, type: deb, path: "docker/debian" , base-image: debian:13-slim } + - { name: ubuntu_24.04, type: deb, path: "docker/ubuntu", base-image: ubuntu:24.04 } + build-rpm: + - ${{ inputs.build_rpm }} + build-deb: + - ${{ inputs.build_deb}} + exclude: + - os: {type: rpm} + build-rpm: false + - os: {type: deb} + build-deb: false needs: - packaging steps: - - name: Skip non relevant builds - id: gate - run: | - if [[ "${{ matrix.os.type }}" == "rpm" && "${{ inputs.build_rpm }}" != "true" ]]; then - echo "skip=true" >> $GITHUB_OUTPUT - elif [[ "${{ matrix.os.type }}" == "deb" && "${{ inputs.build_deb }}" != "true" ]]; then - echo "skip=true" >> $GITHUB_OUTPUT - else - echo "skip=false" >> $GITHUB_OUTPUT - fi - - name: Checkout the repository - if: steps.gate.outputs.skip != 'true' uses: actions/checkout@v4 with: repository: alumet-dev/packaging - name: Create docker artifacts directory - if: steps.gate.outputs.skip != 'true' run: mkdir docker-artifacts - name: Download docker images artifacts - if: steps.gate.outputs.skip != 'true' uses: actions/download-artifact@v4 with: name: ${{ needs.packaging.outputs.artifact_name }} path: ./docker-artifacts - name: Install Goss / Dgoss - if: steps.gate.outputs.skip != 'true' run: | curl -fsSL https://goss.rocks/install | sh - name: Run Dgoss tests - if: steps.gate.outputs.skip != 'true' run: | image_sha=$(docker load -q -i ./docker-artifacts/${{ needs.packaging.outputs.artifact_name }} | grep "Loaded image: "| awk '{ print $3 }' | head -1) export GOSS_FILE=.github/dgoss_validate.yaml set -o pipefail - dgoss run --cap-add=sys_ptrace --cap-add=perfmon --cap-add=sys_nice $image_sha 2>&1 | tee ${{ matrix.os }}-${{ inputs.arch }}-dgoss_tests_report.txt >> $GITHUB_STEP_SUMMARY + dgoss run --cap-add=sys_ptrace --cap-add=perfmon --cap-add=sys_nice $image_sha 2>&1 | tee ${{ matrix.os.name }}-${{ inputs.arch }}-dgoss_tests_report.txt >> $GITHUB_STEP_SUMMARY - name: Upload tests reports - if: always() && steps.gate.outputs.run == 'true' # never skip to have file even in case of test failure + if: always() # never skip to have file even in case of test failure continue-on-error: true uses: actions/upload-artifact@v4 with: - name: ${{ matrix.os }}-${{ inputs.arch }}-dgoss_tests_report.txt - path: ${{ matrix.os }}-${{ inputs.arch }}-dgoss_tests_report.txt + name: ${{ matrix.os.name }}-${{ inputs.arch }}-dgoss_tests_report.txt + path: ${{ matrix.os.name }}-${{ inputs.arch }}-dgoss_tests_report.txt From 43483025e7c0dd5bfb6bc834d6dbbb633d9a207f Mon Sep 17 00:00:00 2001 From: Cyprien Pelisse-Verdoux Date: Wed, 24 Jun 2026 15:04:31 +0200 Subject: [PATCH 3/3] ci(pr_check): remove FORCE_RECREATE env variable --- .github/workflows/pr_check.yaml | 50 ++++++++++++++++++++------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/.github/workflows/pr_check.yaml b/.github/workflows/pr_check.yaml index 05408b6d..9a70b9ad 100644 --- a/.github/workflows/pr_check.yaml +++ b/.github/workflows/pr_check.yaml @@ -19,7 +19,7 @@ concurrency: jobs: - find-changements: + find-changes: runs-on: ubuntu-latest outputs: run-rpm: ${{ steps.get-modified-files.outputs.rpm }} @@ -33,6 +33,8 @@ jobs: with: filters: | rpm: + - 'docker/fedora/**' + - 'docker/ubi/**' - 'rpm/**' - '!rpm/**/*.md' - '!rpm/**/.gitignore' @@ -41,6 +43,8 @@ jobs: - 'deb/**' - '!deb/**/*.md' - '!deb/**/.gitignore' + - 'docker/debian/**' + - 'docker/ubuntu/**' github: - '.github/**' @@ -71,13 +75,13 @@ jobs: rpm: uses: ./.github/workflows/build_rpm.yaml - if: ${{ needs.find-changements.outputs.run-rpm == 'true' || needs.find-changements.outputs.run-all == 'true' }} + if: ${{ needs.find-changes.outputs.run-rpm == 'true' || needs.find-changes.outputs.run-all == 'true' }} strategy: fail-fast: false matrix: arch: [x86_64, aarch64] needs: - - find-changements + - find-changes - setup-input with: arch: ${{ matrix.arch }} @@ -86,13 +90,13 @@ jobs: deb: uses: ./.github/workflows/build_deb.yaml - if: ${{ needs.find-changements.outputs.run-deb == 'true' || needs.find-changements.outputs.run-all == 'true' }} + if: ${{ needs.find-changes.outputs.run-deb == 'true' || needs.find-changes.outputs.run-all == 'true' }} strategy: fail-fast: false matrix: arch: [x86_64, aarch64] needs: - - find-changements + - find-changes - setup-input with: arch: ${{ matrix.arch }} @@ -111,7 +115,7 @@ jobs: version: ${{ needs.setup-input.outputs.version }} release-version: ${{ needs.setup-input.outputs.revision }} needs: - - find-changements + - find-changes - setup-input - rpm - deb @@ -119,10 +123,9 @@ jobs: comment-output: runs-on: ubuntu-latest env: - ORDER: 'first' #could be 'first' or 'last' + ORDER: 'last' #could be 'first' or 'last' SEARCH_STRING: "🔥 Generated artifacts 🔥" BODY: "🔥 Generated artifacts 🔥" - FORCE_RECREATE: true needs: - setup-input - rpm @@ -173,17 +176,18 @@ jobs: `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}` + `/actions/runs/${context.runId}`; - const message = ` - ### ${body} + const message = `### ${body} --- Artefacts can be found there: ${runUrl}`; - - core.exportVariable('COMMENT_BODY', message) + core.info(`Generated comment body:\n${message}`); + console.log('Generated comment body:\n', message); + core.notice(`Comment body generated. Length: ${message.length}`); + core.setOutput('comment-body', message); - name: Create a new comment - if: ${{ env.FORCE_RECREATE == 'true' || steps.find-comment.outputs.comment-id == '' }} + if: ${{ steps.find-comment.outputs.comment-id == '' }} uses: actions/github-script@v9 with: script: | @@ -191,17 +195,25 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: process.env.COMMENT_BODY + body: `${{ steps.get-body.outputs.comment-body }}` }) - name: Update existing comment - if: ${{ env.FORCE_RECREATE != 'true' && steps.find-comment.outputs.comment-id != '' }} + if: ${{ steps.find-comment.outputs.comment-id != '' }} uses: actions/github-script@v9 with: script: | - github.rest.issues.updateComment({ - comment_id: ${{ steps.find-comment.outputs.comment-id }}, + const commentId = '${{ steps.find-comment.outputs.comment-id }}'; + const body = `${{ steps.get-body.outputs.comment-body }}`; + + core.info(`Updating comment ${commentId}`); + core.info(`Comment body:\n${body}`); + + await github.rest.issues.updateComment({ + comment_id: Number(commentId), owner: context.repo.owner, repo: context.repo.repo, - body: process.env.COMMENT_BODY - }) \ No newline at end of file + body + }); + + core.info(`Comment ${commentId} updated successfully`); \ No newline at end of file