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

test restarter workflow #1390

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
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
29 changes: 26 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ on:
workflow_dispatch:

env:
SOURCE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

jobs:

spec:
strategy:
fail-fast: false
Expand All @@ -28,7 +28,7 @@ jobs:
ruby_version: "3.2"
name: "spec (ruby ${{ matrix.ruby_version }})"
uses: "puppetlabs/cat-github-actions/.github/workflows/gem_ci.yml@main"
secrets: "inherit"
secrets: inherit
with:
rake_task: 'spec:coverage'
ruby_version: ${{ matrix.ruby_version }}
Expand All @@ -52,9 +52,32 @@ jobs:
ruby_version: "3.2"
name: "acceptance (ruby ${{ matrix.ruby_version }} | ${{ matrix.os }})"
uses: "puppetlabs/cat-github-actions/.github/workflows/gem_acceptance.yml@main"
secrets: "inherit"
secrets: inherit
with:
ruby_version: ${{ matrix.ruby_version }}
puppet_version: ${{ matrix.puppet_gem_version }}
rake_task: 'acceptance:local'
runs_on: ${{ matrix.os }}

on-failure-workflow-restarter-proxy:
# (1) run this job after the "acceptance" job and...
needs: [acceptance]
# (2) continue ONLY IF "acceptance" fails
if: always() && needs.acceptance.result == 'failure'
runs-on: ubuntu-latest
steps:
# (3) checkout this repository in order to "see" the following custom action
- name: Checkout repository
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: "puppetlabs/cat-github-actions/.github/actions/workflow-restarter-proxy@cat_1820"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
repository: ${{ github.repository }}
run_id: ${{ github.run_id }}
2 changes: 1 addition & 1 deletion .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
# 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
uses: "puppetlabs/cat-github-actions/.github/workflows/workflow-restarter.yml@cat_1820"
env:
SOURCE_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
Expand Down
Loading