From c69169810724d910f02a0509a12f2b64e573edf8 Mon Sep 17 00:00:00 2001 From: sagudev <16504129+sagudev@users.noreply.github.com> Date: Thu, 25 Jan 2024 09:19:35 +0100 Subject: [PATCH] names in trigger try run comment --- .github/workflows/try_labels.yml | 37 ++++++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/.github/workflows/try_labels.yml b/.github/workflows/try_labels.yml index b5ae55dfbfea3..d50662e75fe1a 100644 --- a/.github/workflows/try_labels.yml +++ b/.github/workflows/try_labels.yml @@ -81,13 +81,6 @@ jobs: return ""; } - const url = context.serverUrl + - "/" + context.repo.owner + - "/" + context.repo.repo + - "/actions/runs/" + context.runId; - const formattedURL = "[#" + context.runId + "](" + url + ")"; - makeComment("🔨 Triggering try run (" + formattedURL + ")"); - return try_string; - uses: actions/checkout@v3 if: github.event_name != 'pull_request_target' @@ -112,8 +105,34 @@ jobs: run: | out=$(python ./python/try_parser.py ${{ steps.try_string.outputs.result }}) echo "config<> $GITHUB_OUTPUT - - name: Check output var - run: echo ${{ steps.configuration.outputs.config }} + - name: Collect Labels + if: ${{ steps.try_string.outputs.result }} + uses: actions/github-script@v6 + with: + result-encoding: string + script: | + let config = ${{ steps.configuration.outputs.config }}; + function makeComment(body) { + console.log(body); + + if (context.eventName != 'pull_request_target') + return; + + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body + }) + } + + const url = context.serverUrl + + "/" + context.repo.owner + + "/" + context.repo.repo + + "/actions/runs/" + context.runId; + const formattedURL = "[#" + context.runId + "](" + url + ")"; + makeComment("🔨 Triggering try run (" + formattedURL + ") for " + + config.matrix.map(m => m.name).join(", ")); run-try: