-
Notifications
You must be signed in to change notification settings - Fork 23
58 lines (49 loc) · 1.65 KB
/
update.yaml
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
name: Update
on:
workflow_dispatch:
schedule:
- cron: "13 8 * * *" # 8:13 AM UTC is 12:13 AM PT
jobs:
update:
name: Update root DNS cache
runs-on: ubuntu-22.04
permissions:
# Give the default GITHUB_TOKEN write permission to commit and push the
# added or changed files to the repository.
contents: write
timeout-minutes: 5
steps:
- name: Checkout repo
uses: actions/[email protected]
with:
# token: ${{ secrets.DOMAINRBOT_RW_GITHUB_ACCESS_TOKEN }}
submodules: recursive
- name: Set up Go
uses: actions/[email protected]
with:
go-version: ^1
- name: Update root cache
run: go generate -v -x
- name: Vet Go code
run: go vet ./...
- name: Run Go tests
env:
DNSR_TIMEOUT: 10s
run: go test -mod=readonly -v -race ./...
- name: Commit changes
run: |
[[ -z $(git status -s) ]] || (
git config --global user.email [email protected]
git config --global user.name domainrbot
git add -v --all .
git commit -m "Automatic update for `date -u`"
git push origin -u HEAD
)
- name: Notify if failure
if: ${{ failure() }}
run: |
curl -X POST -H 'Content-type: application/json' --data '{"text":"❌ dnsr update failed."}' ${{ secrets.SLACK_WEBHOOK_URL_GH_ACTIONS }}
# - name: Notify if success
# if: ${{ success() }}
# run: |
# curl -X POST -H 'Content-type: application/json' --data '{"text":"✅ dnsr updated."}' ${{ secrets.SLACK_WEBHOOK_URL_GH_ACTIONS }}