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

(maint) - Update readme #112

Merged
merged 1 commit into from
Sep 30, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/workflow-restarter.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
name: Workflow Restarter
on:
workflow_dispatch:
workflow_call:
inputs:
repo:
description: "GitHub repository name."
Expand Down
13 changes: 5 additions & 8 deletions docs/workflow-restarter.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ on:

jobs:
call-reusable-workflow:
uses: puppetlabs/cat-github-actions/.github/workflows/workflow-restarter.yml@main
uses: "puppetlabs/cat-github-actions/.github/workflows/workflow-restarter.yml@main"
with:
repo: ${{ inputs.repo }}
run_id: ${{ inputs.run_id }}
Expand All @@ -55,7 +55,7 @@ Now add something like the following `yaml` job at the end of your workflow, cha
For example, the following will trigger a restart if either the `acceptance` or the `unit` jobs preceeding it fail. A restart of the failing jobs will be attempted 3 times at which point if the failing jobs continue to fail, then the workflow will be marked as failed. If, however, at any point the `acceptance` and `unit` both pass fine then the restarted workflow will be marked as successful

```yaml
on-failure-workflow-restarter-proxy:
on-failure-workflow-restarter-proxy:
# (1) run this job after the "acceptance" job and...
needs: [acceptance, unit]
# (2) continue ONLY IF "acceptance" fails
Expand All @@ -64,19 +64,16 @@ For example, the following will trigger a restart if either the `acceptance` or
steps:
# (3) checkout this repository in order to "see" the following custom action
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v4

# (4) "use" the custom action to retrigger the failed "acceptance job" above
# NOTE: pass the SOURCE_GITHUB_TOKEN to the custom action because (a) it must have
# this to trigger the reusable workflow that restarts the failed job; and
# (b) custom actions do not have access to the calling workflow's secrets
- name: Trigger reusable workflow
uses: ./.github/actions/workflow-restarter-proxy@main
uses: "puppetlabs/cat-github-actions/.github/actions/workflow-restarter-proxy"
env:
SOURCE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repository: ${{ github.repository }}
run_id: ${{ github.run_id }}

```

## Appendix
Expand Down