'Re-run failed Github Actions Job after updating code related to that job

I have a workflow that runs about 4 jobs. Job #4 tends to have lots of bugs upon updates. For rapid testing's sake, I would like to be able to update the code related to job #4, then re-run only job #4. I know GHA allows you to do this like so...

failed job rerun

...but this only just re-runs the job on the same commit (i.e. my new code doesn't get implemented in this re-run of failed job #4.

A similar question can be found here, but this is for open PRs. I would like to do this on a branch without having a PR just yet.

How can I update code, push it to a branch, then re-run my failed job using the updated code?



Solution 1:[1]

As you already mentioned, the re-run feature only allows re-running the SAME commit. There is no way around that in a single repository.

Using the push trigger should be just as fast as using re-run. If you need to trigger a specific event, there is not really an option available.

You could take a look at nektos/act, which enables you to run GitHub Actions on your local machine within a docker container. This would be way faster than actually running it in the GitHub repository.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 timmeinerzhagen