-
Notifications
You must be signed in to change notification settings - Fork 4
66 lines (63 loc) · 2.06 KB
/
run.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
name: Weekly email service
on:
schedule:
# Runs “At 07:30 on Wednesday.” UTC+11 (see https://crontab.guru) & remember that the below is in UTC!
- cron: '30 20 * * 2'
workflow_dispatch:
inputs:
dry_run:
default: true
type: boolean
env:
timezone: 'Australia/Melbourne'
TZ: 'Australia/Melbourne'
# n.b shocked to learn GH actions don't support yaml anchors (https://github.com/actions/runner/issues/1182)
jobs:
github:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Place shopping list
run: |
echo '${{ secrets.SHOPPING_LIST }}' >> shopping-list.json
- name: Email comparisons
env:
MAILERSEND_API_KEY: ${{ secrets.MAILERSEND_API_KEY }}
FROM_ADDRESS: no-reply@${{ secrets.DOMAIN }}
run: |
python coles_vs_woolies shopping-list.json \
${{ (github.event_name == 'workflow_dispatch' && inputs.dry_run) && '--dry_run' || '' }}
local:
needs: github
if: always() && contains(needs.*.result, 'failure')
runs-on: self-hosted
steps:
- name: Check out repo
uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'pip'
- name: Install dependencies
run: |
pip install -r requirements.txt
- name: Place shopping list
run: |
echo '${{ secrets.SHOPPING_LIST }}' >> shopping-list.json
- name: Email comparisons
env:
MAILERSEND_API_KEY: ${{ secrets.MAILERSEND_API_KEY }}
FROM_ADDRESS: no-reply@${{ secrets.DOMAIN }}
run: |
python coles_vs_woolies shopping-list.json \
${{ (github.event_name == 'workflow_dispatch' && inputs.dry_run) && '--dry_run' || '' }}