Skip to content
Open
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
7 changes: 7 additions & 0 deletions .github/workflows/example-charm-charmcraft-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,10 @@ jobs:
# allocator (runs against the runner itself) instead of launching
# a nested LXD VM for the spread target.
run: charmcraft test "craft:ubuntu-24.04:spread/integration/${{ matrix.task }}"

open-issue-on-failure-if-scheduled:
if: ${{ failure() && github.event_name == 'schedule' }}
needs: [collect-spread-jobs, integration]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
needs: [collect-spread-jobs, integration]
needs: [integration]

permissions:
issues: write
uses: ./.github/workflows/notify-scheduled-failure.yaml
7 changes: 7 additions & 0 deletions .github/workflows/example-charm-integration-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,10 @@ jobs:
run: |
cd ${{ matrix.dir }}
tox -e integration
open-issue-on-failure-if-scheduled:
if: ${{ failure() && github.event_name == 'schedule' }}
needs: [machine-examples-integration, k8s-examples-integration]
permissions:
issues: write
uses: ./.github/workflows/notify-scheduled-failure.yaml
7 changes: 7 additions & 0 deletions .github/workflows/integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,10 @@ jobs:
# tracing tests each deploy the tempo stack into their own fresh
# model, so that file needs longer than the others.
timeout-minutes: ${{ matrix.test == 'test/integration/test_tracing.py' && 40 || 20 }}

open-issue-on-failure-if-scheduled:
if: ${{ failure() && github.event_name == 'schedule' }}
needs: [collect, integration]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
needs: [collect, integration]
needs: [integration]

permissions:
issues: write
uses: ./.github/workflows/notify-scheduled-failure.yaml
26 changes: 26 additions & 0 deletions .github/workflows/notify-scheduled-failure.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Notify on scheduled failure

# Reusable workflow: opens an issue when a scheduled workflow fails.
# Callers gate the invocation with `if: failure() && github.event_name == 'schedule'`
# and pass `permissions: issues: write`.

on:
workflow_call:

jobs:
open-issue:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Create issue on failure
env:
GH_TOKEN: ${{ github.token }}
WORKFLOW_NAME: ${{ github.workflow }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
WORKFLOW_NAME: ${{ github.workflow }}
WORKFLOW_NAME: ${{ github.workflow }} # The workflow that called this one.

REPO: ${{ github.repository }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
run: |
gh issue create \
--repo "$REPO" \
--title "Scheduled workflow '$WORKFLOW_NAME' failed" \
--body "Scheduled workflow '$WORKFLOW_NAME' failed: $RUN_URL"
7 changes: 7 additions & 0 deletions .github/workflows/smoke.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,10 @@ jobs:
with:
name: charmcraft-logs
path: /home/runner/.local/state/charmcraft/log/*.log

open-issue-on-failure-if-scheduled:
if: ${{ failure() && github.event_name == 'schedule' }}
needs: [test]
permissions:
issues: write
uses: ./.github/workflows/notify-scheduled-failure.yaml
7 changes: 7 additions & 0 deletions .github/workflows/tiobe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,10 @@ jobs:
ticsAuthToken: ${{ secrets.TICSAUTHTOKEN }}
project: operator
installTics: true

open-issue-on-failure-if-scheduled:
if: ${{ failure() && github.event_name == 'schedule' }}
needs: [TICS]
permissions:
issues: write
uses: ./.github/workflows/notify-scheduled-failure.yaml
7 changes: 7 additions & 0 deletions .github/workflows/update-best-practice-doc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,10 @@ jobs:
working-directory: operator
env:
GITHUB_TOKEN: ${{ secrets.UPDATE_DOCS_ACCESS_TOKEN }}
open-issue-on-failure-if-scheduled:
if: ${{ failure() && github.event_name == 'schedule' }}
needs: [update-docs]
permissions:
issues: write
uses: ./.github/workflows/notify-scheduled-failure.yaml
7 changes: 7 additions & 0 deletions .github/workflows/update-charm-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,10 @@ jobs:
fi
env:
GITHUB_TOKEN: ${{ secrets.UPDATE_CHARM_PINS_ACCESS_TOKEN }}
open-issue-on-failure-if-scheduled:
if: ${{ failure() && github.event_name == 'schedule' }}
needs: [update-pins]
permissions:
issues: write
uses: ./.github/workflows/notify-scheduled-failure.yaml
Loading