Skip to content

Commit 8c5b096

Browse files
authored
Update mod-update.yml
1 parent 85b0667 commit 8c5b096

File tree

1 file changed

+17
-28
lines changed

1 file changed

+17
-28
lines changed

.github/workflows/mod-update.yml

Lines changed: 17 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,55 @@
1-
name: Update Hugo Dependencies
1+
name: Update Hugo dependencies
22
on:
33
workflow_dispatch:
44
schedule:
5-
- cron: '0 3 * * *' # Run daily at 03:00 AM
6-
5+
- cron: '0 3 * ' # run daily at 03:00 AM
76
permissions:
87
contents: write
98
pull-requests: write
10-
119
jobs:
12-
update-hugo-modules:
10+
update-mod:
1311
runs-on: ubuntu-latest
14-
1512
steps:
16-
# Step 1: Checkout repository
1713
- name: Checkout repository
1814
uses: actions/checkout@v4
19-
20-
# Step 2: Setup Node.js
21-
- name: Setup Node.js environment
15+
- name: Setup Node.js
2216
uses: actions/setup-node@v4
2317
with:
2418
node-version: lts/*
2519
cache: 'npm'
26-
cache-dependency-path: '**/package-lock.json'
27-
28-
# Step 3: Install dependencies
29-
- name: Install npm dependencies
20+
cache-dependency-path: '/package-lock.json'
21+
- name: Perform clean install of npm
3022
run: npm ci
31-
32-
# Step 4: Update Hugo module dependencies
3323
- name: Update Hugo module dependencies
34-
id: update-modules
24+
id: mod-updates
3525
run: |
3626
MOD_OUTPUT=$(npm run mod:update 2>&1)
3727
echo "$MOD_OUTPUT"
3828
MOD_UPDATES=$(echo "$MOD_OUTPUT" | grep '^go: upgraded' | sed 's/go: / - /' | sort -u)
3929
echo 'MOD_UPDATES<<EOF' >> $GITHUB_OUTPUT
40-
echo "$MOD_UPDATES" >> $GITHUB_OUTPUT
30+
echo "$MOD_UPDATES" >> "$GITHUB_OUTPUT"
4131
echo 'EOF' >> $GITHUB_OUTPUT
42-
43-
# Step 5: Create a Pull Request for changes
4432
- name: Create Pull Request
45-
uses: peter-evans/create-pull-request@v7
33+
uses: gethinode/create-pull-request@v6
4634
with:
47-
token: ${{ secrets.GITHUB_TOKEN }}
35+
token: ${{ secrets.HUGO_MOD_PR }}
4836
commit-message: 'fix: update Hugo module dependencies'
4937
committer: GitHub <noreply@github.com>
5038
branch: hugo-mod-dependencies
5139
delete-branch: true
5240
title: 'Update Hugo module dependencies'
5341
body: |
5442
This PR is auto-generated by [create-pull-request][1].
55-
56-
**Changes to Hugo modules:**
57-
58-
${{ steps.update-modules.outputs.MOD_UPDATES }}
5943
44+
Changes to go.mod:
45+
46+
${{ steps.mod-updates.outputs.MOD_UPDATES }}
6047
[1]: https://github.com/peter-evans/create-pull-request
6148
labels: dependencies
49+
# Note: remove /go.mod and /go.sum if your repository does not have an exampleSite
50+
# or any other subfolder that uses Hugo modules
6251
add-paths: |
6352
go.mod
6453
go.sum
65-
**/go.mod
66-
**/go.sum
54+
/go.mod
55+
/go.sum

0 commit comments

Comments
 (0)