Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding run-link as output #500

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
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
4 changes: 2 additions & 2 deletions actions/wait-for-workflow-job/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
labels: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@V4
uses: actions/checkout@<not sure what commit to use here, cant find in tags>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one of the recent PRs that updated this action - https://github.com/smartcontractkit/.github/pull/498/files

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using commits/tags from: https://github.com/actions/checkout/tags

... 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@<commit> # [email protected]
with:
repo: smartcontractkit/chainlink
workflow-run-id: ${{ steps.dispatch.outputs.run-id }}
Expand Down
10 changes: 10 additions & 0 deletions actions/wait-for-workflow-job/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you mean echo "run-link=\"\""?

exit 1
fi

Expand Down Expand Up @@ -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

Expand All @@ -111,13 +118,16 @@ 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
echo "Job has completed."
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
Expand Down
Loading