-
Notifications
You must be signed in to change notification settings - Fork 52
Skip already passed tests using GH API #1087
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
Skip already passed tests using GH API #1087
Conversation
57d23fd
to
7748011
Compare
I'll test it in Rene's repo first:https://github.com/rene/eden/actions/runs/16448206031/job/46486153891?pr=2 |
No, it does not work as expected... |
5e40f9c
to
39fc0b5
Compare
Add logic to detect whether a job has already succeeded in a previous workflow attempt using the GitHub Actions API. This enables us to use the "Rerun all jobs" button without re-running already successful jobs. We currently report commit status manually in a parent workflow. If "Rerun failed jobs" is used, GitHub postpones execution of the status reporting step until all rerun jobs complete, leaving the UI stuck in an outdated state. To trigger status updates promptly, we must use "Rerun all jobs". With this change, each job queries the previous attempt using the GitHub CLI and exits early if it already succeeded, saving time and resources while still updating commit status immediately. Signed-off-by: Nikolay Martyanov <[email protected]>
39fc0b5
to
4fec9bc
Compare
It works, tested in Renes repo! https://github.com/rene/eden/actions/runs/16491015929?pr=2 |
@@ -145,19 +200,44 @@ jobs: | |||
echo "Public IP Address of the runner:" | |||
curl -s https://api.ipify.org | |||
shell: bash | |||
- name: Check job status from previous attempt | |||
id: prev_attempt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to make it as a reusable action under eden so that we don't have to duplicate code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be a reusable step... Maybe we can make it, but I did not try. I'll take a look
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll create an Issue to move those copied steps into resuable action, as of now we merge as it is and move forward
Introduce logic to skip Eden jobs that have already succeeded by checking the status of the same job in a previous workflow attempt using the GitHub Actions API. This makes it safe and efficient to use the "Rerun all jobs" button without re-running jobs that have already passed.
We currently report commit status manually in a parent workflow that depends on this one. When "Rerun failed jobs" is used, GitHub delays the execution of the status-reporting step until all re-executed jobs complete. This results in a stale and misleading UI until the rerun finishes.
To force GitHub to immediately update the status, we must use "Rerun all jobs". This change ensures that even when we rerun everything, previously successful jobs detect their prior result and exit early, saving time and compute while still enabling timely status updates.
Each job uses its name and matrix context to query its conclusion from the previous attempt via the GitHub CLI (gh api). If the job was already successful, it exits without running the test again. This logic ensures consistent job naming and reliable detection across reruns.