From b5d32eddb4d6d5b2805da886a0d810d7939d9f30 Mon Sep 17 00:00:00 2001 From: Nikolay Martyanov Date: Fri, 4 Jul 2025 17:20:58 +0200 Subject: [PATCH] fix-status --- .github/workflows/eden-trusted.yml | 33 ++++++++++++++++-------------- 1 file changed, 18 insertions(+), 15 deletions(-) diff --git a/.github/workflows/eden-trusted.yml b/.github/workflows/eden-trusted.yml index 15aa941c8bb..85dda13e2e7 100644 --- a/.github/workflows/eden-trusted.yml +++ b/.github/workflows/eden-trusted.yml @@ -40,13 +40,14 @@ jobs: result-encoding: string script: | const { owner, repo } = context.repo; - const head_sha = context.payload.workflow_run.head_sha; // commit in the PR - const name = process.env.CHECK_NAME; - const { data } = await github.checks.create({ + const head_sha = context.payload.workflow_run.head_sha; + const name = process.env.CHECK_NAME; + + const { data } = await github.rest.checks.create({ owner, repo, name, head_sha, - status: 'in_progress', + status: 'in_progress', started_at: new Date().toISOString(), output: { title: 'Runner workflow started', @@ -55,6 +56,7 @@ jobs: }); core.setOutput('id', data.id.toString()); + test_suite_pr: needs: context if: ${{ needs.context.outputs.pr != '' }} # guard @@ -82,26 +84,27 @@ jobs: uses: actions/github-script@v7 env: CHECK_ID: ${{ needs.context.outputs.check_id }} - RESULT: ${{ needs.test_suite_pr.result }} # success / failure / cancelled + RESULT: ${{ needs.test_suite_pr.result }} with: script: | const { owner, repo } = context.repo; - const id = Number(process.env.CHECK_ID); - const result = process.env.RESULT; + const id = Number(process.env.CHECK_ID); - const conclusion = ( - result === 'success' ? 'success' : - result === 'failure' ? 'failure' : - result === 'cancelled' ? 'cancelled' : 'neutral' - ); + const conclusion = ({ + success: 'success', + failure: 'failure', + cancelled: 'cancelled' + })[process.env.RESULT] || 'neutral'; - await github.checks.update({ - owner, repo, check_run_id: id, + await github.rest.checks.update({ + owner, repo, + check_run_id: id, status: 'completed', completed_at: new Date().toISOString(), conclusion, output: { title: 'Eden trusted tests', - summary: `Workflow **${conclusion}**.\n\n[View logs](${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID})` + summary: `Workflow **${conclusion}**.\n\n[Logs](${process.env.GITHUB_SERVER_URL}/${process.env.GITHUB_REPOSITORY}/actions/runs/${process.env.GITHUB_RUN_ID})` } }); +