-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (37 loc) · 1.16 KB
/
update-nibble.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
name: Update Nibble Link
on:
schedule:
- cron: '0 */3 * * 0,1,6' # Runs every 3 hours near publishing days
workflow_dispatch:
jobs:
update-link:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install dependencies
run: npm install
- name: Update Nibble Link
run: node updateNibble.js
- name: Get latest Nibble number
id: read-nibble-link
run: echo "number=$(cat current_link.txt | cut -d'|' -f2)" >> $GITHUB_OUTPUT
- name: Push changes
run: |
git config user.name "Nibble Devs"
git config user.email "[email protected]"
if [[ -n "$(git status --porcelain)" ]]; then
git add .
git commit -m "Automated update of Nibble ${{ steps.read-nibble-link.outputs.number }}"
git push
else
echo "No changes to commit"
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}