-
Notifications
You must be signed in to change notification settings - Fork 3
30 lines (27 loc) · 917 Bytes
/
update-date.yaml
File metadata and controls
30 lines (27 loc) · 917 Bytes
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
on:
schedule:
- cron: '30 5 1 * *'
jobs:
update:
runs-on: ubuntu-latest
name: Add next file
steps:
- uses: actions/checkout@v3
- name: Create file and push
run: |
sudo apt update && sudo apt install -y ncal
next_hack_date=$(date -u +%Y-%m-$(ncal -h | awk '/Sa/ {print $(NF)}'))
last_hack_number=$(ls -1 _hacks | sort -r | head -n1 | sed 's/[^0-9]*//g')
next_hack_number=$(($last_hack_number+1))
cat << EOF > _hacks/$next_hack_number.md
---
hack_number: $next_hack_number
date: $next_hack_date
upcoming: true
---
EOF
git config --global user.email "date-bot@remotehack.com"
git config --global user.name "date-bot"
git add .
git commit -m "Add hack number $next_hack_number on $next_hack_date"
git push origin main