feat: Add support for reusable workflows and previous run attempts #352
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hey, thanks for creating and maintaining this project! It has the potential to reduce our GitHub Action minutes usage by a lot.
We use a lot of reusable workflows, and after I saw #327 I understood that this action couldn't see duplicates if they were triggered by different parent workflows. I've added a
reusable_workflow_filepathinput that lets you tell the action to look at the history of a specific reusable workflow. This allows it to find successful duplicates no matter where they were called from.Due to limitations in the GH API, there isn't any scope for getting info about the specifics of the reusable workflow's run only it's calling run, so this should only be used on reusable workflows that are never skipped for other reasons.
Also, mainly for testing purposes, but possibly useful in other scenarios, I've added an
include_previous_attempts_of_same_runinput. At the moment the action will ignore all previous attempts of the current workflow. With this option enabled, the action will look at the previous attempts for the same run and can skip the new one if an earlier attempt already succeeded.I also added a couple of new test workflows (
caller-workflow-for-testing.ymlandreusable-workflow-for-testing.yml) to make sure these new features work as expected. The test is to let the caller workflow run successfully, then manually re-run it, which should skip the second step of the reusable workflow.Thanks again for all your work on this. Let me know what you think 👍
Fixes #327