-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (59 loc) · 2.23 KB
/
Copy pathweekly-menu-fetch.yml
File metadata and controls
69 lines (59 loc) · 2.23 KB
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
67
68
69
name: Weekly Menu Fetch
# Dispatched by the scheduler Worker in worker/ on Mondays at 06:00 Europe/Zurich.
on:
workflow_dispatch:
jobs:
fetch-menus:
name: Fetch Menu for ${{ matrix.restaurant }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
restaurant: [gira, luna, sole, espace]
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_ACCESS_KEY_ID: ${{ secrets.CLOUDFLARE_ACCESS_KEY_ID }}
CLOUDFLARE_SECRET_ACCESS_KEY: ${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }}
CLOUDFLARE_BUCKET_NAME: ${{ secrets.CLOUDFLARE_BUCKET_NAME }}
steps:
- name: Checkout code
uses: actions/checkout@v5
- name: Set up Go
uses: actions/setup-go@v6
with:
go-version: '1.24'
cache: true
- name: Build application
run: GOARCH=amd64 GOOS=linux go build -o lunch-app ./cmd/app/main.go
- name: Run binary inside container with chromedp
uses: nick-fields/retry@v4
with:
max_attempts: 3
retry_wait_seconds: 15
timeout_minutes: 5
command: |
docker run --rm --platform linux/amd64 \
--entrypoint /app/lunch-app \
-v ${{ github.workspace }}/lunch-app:/app/lunch-app \
-e OPENAI_API_KEY=${{ secrets.OPENAI_API_KEY }} \
-e CLOUDFLARE_ACCOUNT_ID=${{ secrets.CLOUDFLARE_ACCOUNT_ID }} \
-e CLOUDFLARE_ACCESS_KEY_ID=${{ secrets.CLOUDFLARE_ACCESS_KEY_ID }} \
-e CLOUDFLARE_SECRET_ACCESS_KEY=${{ secrets.CLOUDFLARE_SECRET_ACCESS_KEY }} \
-e CLOUDFLARE_BUCKET_NAME=${{ secrets.CLOUDFLARE_BUCKET_NAME }} \
chlab/lunch-wankdorf:latest \
-restaurant ${{ matrix.restaurant }} -upload
report:
name: Report to healthchecks
runs-on: ubuntu-latest
needs: fetch-menus
if: always()
steps:
- name: Ping healthchecks
run: |
url='${{ secrets.HC_PING_MENU_FETCH }}'
if [ '${{ needs.fetch-menus.result }}' = 'success' ]; then
curl -fsS -m 10 --retry 3 "$url"
else
curl -fsS -m 10 --retry 3 "$url/fail"
fi