-
Notifications
You must be signed in to change notification settings - Fork 0
62 lines (58 loc) · 1.7 KB
/
update-points.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
name: Update HLTV ranking points
on:
schedule:
# Monday
# 19:00 CET/CEST
# 17:00/18:00 UTC
- cron: '11 17,18 * * MON'
workflow_dispatch:
permissions:
contents: write
jobs:
check-run:
runs-on: ubuntu-latest
outputs:
run: ${{ steps.check_local_time.outputs.run }}
steps:
- name: Check local time
id: check_local_time
env:
TRIGGER: ${{ github.event_name }}
run: |
echo "Trigger: ${TRIGGER}"
if [[ ${TRIGGER} == 'schedule' ]]; then
echo "Checking daylight saving time"
if [ $(TZ="Europe/Copenhagen" date +%H) -eq '19' ]; then
echo 'Time to run!'
echo "run=True" >> "$GITHUB_OUTPUT"
else
echo "It's not 19:11 local time in Europe/Copenhagen. Waiting for next execution..."
echo "run=False" >> "$GITHUB_OUTPUT"
fi
else
echo 'Trigger is not cron, ommiting time check!'
echo "run=True" >> "$GITHUB_OUTPUT"
fi
update-points:
runs-on: ubuntu-latest
if: needs.check-run.outputs.run == 'True'
needs: check-run
steps:
- name: Checkout
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: ".nvmrc"
cache: "npm"
- name: npm install
run: npm ci
- name: update-points
run: npm run update-points
- uses: EndBug/add-and-commit@v9
with:
default_author: github_actions
message: 'Updated HLTV team ranking points'
add: 'src/hltv-team-points.ts'