From f873a39022a2a86540cb8a9d41dbada2c3e678ab Mon Sep 17 00:00:00 2001 From: yashnevatia Date: Mon, 8 Jul 2024 16:29:30 +0800 Subject: [PATCH 1/2] adding run-link as output --- actions/wait-for-workflow-job/README.md | 4 ++-- actions/wait-for-workflow-job/action.yml | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/actions/wait-for-workflow-job/README.md b/actions/wait-for-workflow-job/README.md index 0ac271d2..7f3fbaf1 100644 --- a/actions/wait-for-workflow-job/README.md +++ b/actions/wait-for-workflow-job/README.md @@ -18,10 +18,10 @@ jobs: labels: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@V4 + uses: actions/checkout@ ... dispatch the workflow you want and get its workflow run id, then: - name: Get Job Results - uses: smartcontractkit/.github/wait-for-workflow-job@main + uses: smartcontractkit/.github/wait-for-workflow-job@ # wait-for-workflow-job@x.y.z with: repo: smartcontractkit/chainlink workflow-run-id: ${{ steps.dispatch.outputs.run-id }} diff --git a/actions/wait-for-workflow-job/action.yml b/actions/wait-for-workflow-job/action.yml index fe518922..6c5d45dd 100644 --- a/actions/wait-for-workflow-job/action.yml +++ b/actions/wait-for-workflow-job/action.yml @@ -29,6 +29,11 @@ inputs: required: false default: "1800" # 30 minutes +outputs: + run-link: + description: The found run link + value: ${{ steps.get-run-id.outputs.run-link }} + runs: using: composite steps: @@ -57,6 +62,7 @@ runs: # Check if the maximum wait time has been exceeded if [ "$elapsed_time" -ge "$max_wait_seconds" ]; then echo "Timeout reached without job starting." + echo "run-link=""" >> $GITHUB_OUTPUT exit 1 fi @@ -88,6 +94,7 @@ runs: # If the job ID is still not found, exit with an error if [ -z "$job_id" ]; then echo "Job '${JOB_NAME}' was never found." + echo "run-link=""" >> $GITHUB_OUTPUT exit 1 fi @@ -111,6 +118,8 @@ runs: "https://api.github.com/repos/${REPO}/actions/jobs/$job_id") job_status=$(echo "$job_details" | jq -r '.status') job_conclusion=$(echo "$job_details" | jq -r '.conclusion') + job_html_url=$(echo "$job_details" | jq -r '.html_url') + echo "run-link=$job_html_url" >> $GITHUB_OUTPUT # Check if the job has a conclusion if [[ "$job_conclusion" != "null" ]]; then From cc8576eebdc1c0dae200278b7e4fbf44e5c06769 Mon Sep 17 00:00:00 2001 From: yashnevatia Date: Mon, 8 Jul 2024 17:12:47 +0800 Subject: [PATCH 2/2] echo job link --- actions/wait-for-workflow-job/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/actions/wait-for-workflow-job/action.yml b/actions/wait-for-workflow-job/action.yml index 6c5d45dd..6fa008ea 100644 --- a/actions/wait-for-workflow-job/action.yml +++ b/actions/wait-for-workflow-job/action.yml @@ -127,6 +127,7 @@ runs: break fi echo "job status: ${job_status}" + echo "job link: ${job_html_url}" echo "Job is still in progress. Sleeping $sleep_time seconds..." sleep $sleep_time # Adjust the sleep time as necessary done