Skip to content

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

Merged
merged 1 commit into from
Jul 24, 2025

Conversation

OhmSpectator
Copy link
Member

@OhmSpectator OhmSpectator commented Jul 22, 2025

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.

@OhmSpectator
Copy link
Member Author

OhmSpectator commented Jul 22, 2025

I'll test it in Rene's repo first:https://github.com/rene/eden/actions/runs/16448206031/job/46486153891?pr=2

@OhmSpectator
Copy link
Member Author

No, it does not work as expected...

@OhmSpectator OhmSpectator marked this pull request as draft July 22, 2025 18:57
@OhmSpectator OhmSpectator changed the title Skip already passed tests using artifact markers. [WIP] Skip already passed tests using artifact markers. Jul 22, 2025
@OhmSpectator OhmSpectator force-pushed the feature/self-made-rerun branch from 5e40f9c to 39fc0b5 Compare July 24, 2025 01:04
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]>
@OhmSpectator OhmSpectator force-pushed the feature/self-made-rerun branch from 39fc0b5 to 4fec9bc Compare July 24, 2025 07:55
@OhmSpectator OhmSpectator changed the title [WIP] Skip already passed tests using artifact markers. Skip already passed tests using GH API Jul 24, 2025
@OhmSpectator OhmSpectator marked this pull request as ready for review July 24, 2025 08:05
@OhmSpectator
Copy link
Member Author

OhmSpectator commented Jul 24, 2025

It works, tested in Renes repo! https://github.com/rene/eden/actions/runs/16491015929?pr=2
@uncleDecart take a look please

@@ -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
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member

@uncleDecart uncleDecart left a 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

@OhmSpectator OhmSpectator merged commit 7df0877 into lf-edge:master Jul 24, 2025
16 of 19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants