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
37 changes: 31 additions & 6 deletions .github/actions/utils/add-comment/action.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
name: Add Comment
description: "Posts a comment on the pull-request"
description: "Posts a comment on the pull-request or updates an existing one"

inputs:
commentMessage:
description: "Message that will be put as a comment"
required: true
commentId:
description: "Optional comment ID to update instead of creating new one"
required: false

outputs:
commentId:
description: "The ID of the created or updated comment"
value: ${{ steps.comment-and-check.outputs.comment-id }}

runs:
using: composite
Expand All @@ -14,11 +22,13 @@ runs:
uses: actions/github-script@v7
env:
MESSAGE: ${{ inputs.commentMessage }}
COMMENT_ID: ${{ inputs.commentId }}
with:
script: |
const {owner, repo} = context.repo;

const msg = process.env.MESSAGE
const commentId = process.env.COMMENT_ID
let sha = undefined
let prNumber = undefined;

Expand All @@ -38,14 +48,29 @@ runs:
} else {
sha ||= context.sha;
}
core.info(`Going to put a comment to PR ${prNumber}” (“${sha}) - ${msg}`);

core.info(`Going to put a comment to PR "${prNumber}" ("${sha}") - "${msg}"`);

//------------------------------------------------------------------
// 2) Add / update PR comment
//------------------------------------------------------------------
if (prNumber) {
await github.rest.issues.createComment({
owner, repo, issue_number: prNumber, body: msg
});
// Update existing comment if commentId provided
if (commentId) {
core.info(`Updating existing comment ${commentId}`);
await github.rest.issues.updateComment({
owner,
repo,
comment_id: commentId,
body: msg
});
core.setOutput('comment-id', commentId);
} else {
// Create new comment
core.info(`Creating new comment`);
const comment = await github.rest.issues.createComment({
owner, repo, issue_number: prNumber, body: msg
});
core.setOutput('comment-id', comment.data.id);
}
}
13 changes: 12 additions & 1 deletion .github/workflows/system-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,28 @@ jobs:
if: |-
${{ always() &&
(needs.check-rights.result == 'success' || github.event_name == 'pull_request') &&
needs.parse-params.outputs.shouldRun == 'true'
needs.parse-params.outputs.shouldRun == 'true'
}}
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
outputs:
buildRunId: ${{ steps.verify.outputs.buildRunId }}
buildMetadataSha: ${{ steps.verify.outputs.buildMetadataSha }}
commentId: ${{ steps.initial-comment.outputs.commentId }}
steps:
- uses: actions/checkout@v5
with:
ref: ${{ needs.parse-params.outputs.ref }}
- name: Add initial comment
id: initial-comment
if: ${{ github.event_name == 'issue_comment' }}
uses: ./.github/actions/utils/add-comment
with:
commentMessage: ':hourglass_flowing_sand: System test verification started: [link](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})

Waiting for build to finish...'
- name: Get merge commit SHA
id: get-merge-sha
run: |
Expand Down Expand Up @@ -170,6 +180,7 @@ jobs:
if: ${{ github.event_name == 'issue_comment' && steps.validate.outputs.isValid == 'true' }}
uses: ./.github/actions/utils/add-comment
with:
commentId: ${{ needs.check-build.outputs.commentId }}
commentMessage: ':hourglass_flowing_sand: System test verification started: [link](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})

${{ steps.validate.outputs.message }}'
Expand Down