-
Notifications
You must be signed in to change notification settings - Fork 0
64 lines (56 loc) · 1.99 KB
/
Copy pathupdate.yml
File metadata and controls
64 lines (56 loc) · 1.99 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
name: Update job listings
on:
schedule:
# Daily, ~6:20am ET. Odd minute to avoid GitHub's on-the-hour cron congestion.
- cron: "23 10 * * *"
workflow_dispatch: {}
permissions:
contents: write
issues: write
concurrency:
group: update-listings
cancel-in-progress: true
jobs:
update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 22
- name: Regenerate listings
run: node .github/scripts/update.mjs .github/scripts/config.json --out .
- name: Commit and push if changed
run: |
git config user.name "dreamwork-bot"
git config user.email "bots@dreamworkhq.com"
git add README.md data/listings.json
if git diff --staged --quiet; then
echo "No changes today."
else
git commit -m "chore: update listings ($(date -u +%Y-%m-%d))"
git push
fi
- name: Open issue on failure
if: failure()
uses: actions/github-script@v7
with:
script: |
const label = "update-failure";
const { data: open } = await github.rest.issues.listForRepo({
...context.repo, state: "open", labels: label,
});
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
if (open.length > 0) {
await github.rest.issues.createComment({
...context.repo, issue_number: open[0].number,
body: `Daily update failed again: ${runUrl}`,
});
} else {
await github.rest.issues.create({
...context.repo,
title: `Daily listings update is failing (${new Date().toISOString().slice(0, 10)})`,
body: `The scheduled update workflow failed. Latest run: ${runUrl}\n\ncc @benadamsky`,
labels: [label],
});
}