Skip to content

Commit

Permalink
Add manual trigger
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric Giguere committed Oct 20, 2023
1 parent 5d2593f commit 1b7112e
Showing 1 changed file with 43 additions and 22 deletions.
65 changes: 43 additions & 22 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ on:
schedule:
- cron: "0 12 * * 0" # Every Sunday at noon UTC

workflow_dispatch:
inputs:
email:
description: "Destination email on failure (optional):"
default: "None"

defaults:
run:
# The slightly odd shell call is to force bash to read .bashrc, which is
Expand Down Expand Up @@ -70,33 +76,48 @@ jobs:
# limit coverage reporting to code that's within the qutip_jax package
# --color=yes
# force coloured output in the terminal
# --cov-report=
# don't print the coverage report to the terminal---it just adds
# cruft, and we're going to upload the .coverage file to Coveralls
# -W ignore::UserWarning:qutip
# Ignore matplotlib missing warnings
# These flags are added to those in pyproject.toml.
finalise:
name: Send Email on Failure
needs: cases
if: failure()
runs-on: ubuntu-latest
uses: dawidd6/action-send-mail@v3
with:
# Required mail server address if not connection_url:
server_address: smtp-mail.outlook.com
server_port: 587
secure: true
# Optional (recommended) mail server username:
username: ${{ secrets.OUTLOOK_ADR }}
# Optional (recommended) mail server password:
password: ${{ secrets.OUTLOOK_PWD }}
# Required mail subject:
subject: ${{ github.job }} job of ${{ github.repository }} has ${{ job.status }}
# Required recipients' addresses:
to: [email protected]
# Required sender full name (address can be skipped):
from: QuTiP-Jax
# Optional plain body:
body: ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }}
steps:
- name: Check destination
id: dest_email
run: |
if [[ -z "${{ inputs.email }}" ]]; then
# Trigerred by schedule
echo "destination='[email protected]' " >> $GITHUB_OUTPUT;
elif [[ "${{ inputs.email }}" != "None" ]]; then
# Trigerred manually with email entered
echo "destination=${{ inputs.email }}" >> $GITHUB_OUTPUT;
else
# Trigerred manually without email entered
echo "destination=" >> $GITHUB_OUTPUT;
fi
- name: Send Email on Failure
# No email sent if trigerred manually and no address is provided.
if: ${{ steps.dest_email.outputs.destination }} != ""

uses: dawidd6/action-send-mail@v3
with:
# Required mail server address if not connection_url:
server_address: smtp-mail.outlook.com
server_port: 587
secure: true
# Optional (recommended) mail server username:
username: ${{ secrets.OUTLOOK_ADR }}
# Optional (recommended) mail server password:
password: ${{ secrets.OUTLOOK_PWD }}
# Required mail subject:
subject: ${{ github.job }} job of ${{ github.repository }} has ${{ job.status }}
# Required recipients' addresses:
to: ${{ steps.dest_email.outputs.destination }}
# Required sender full name (address can be skipped):
from: QuTiP-Jax
# Optional plain body:
body: ${{ github.job }} job in worflow ${{ github.workflow }} of ${{ github.repository }} has ${{ job.status }}

0 comments on commit 1b7112e

Please sign in to comment.