generated from gethinode/mod-template
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (53 loc) · 1.76 KB
/
mod-update.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
63
name: Update Hugo dependencies
on:
workflow_dispatch:
schedule:
- cron: '0 3 * * *' # run daily at 03:00 AM
permissions:
contents: write
pull-requests: write
jobs:
update-mod:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: lts/*
cache: 'npm'
cache-dependency-path: '**/package-lock.json'
- name: Perform clean install of npm
run: npm ci
- name: Update Hugo module dependencies
id: mod-updates
run: |
MOD_OUTPUT=$(npm run mod:update 2>&1)
echo "$MOD_OUTPUT"
MOD_UPDATES=$(echo "$MOD_OUTPUT" | grep '^go: upgraded' | sed 's/go: / - /' | sort -u)
echo 'MOD_UPDATES<<EOF' >> $GITHUB_OUTPUT
echo "$MOD_UPDATES" >> "$GITHUB_OUTPUT"
echo 'EOF' >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: gethinode/create-pull-request@v6
with:
token: ${{ secrets.HUGO_MOD_PR }}
commit-message: 'fix: update Hugo module dependencies'
committer: GitHub <[email protected]>
branch: hugo-mod-dependencies
delete-branch: true
title: 'Update Hugo module dependencies'
body: |
This PR is auto-generated by [create-pull-request][1].
Changes to go.mod:
${{ steps.mod-updates.outputs.MOD_UPDATES }}
[1]: https://github.com/peter-evans/create-pull-request
labels: dependencies
# Note: remove **/go.mod and **/go.sum if your repository does not have an exampleSite
# or any other subfolder that uses Hugo modules
add-paths: |
go.mod
go.sum
**/go.mod
**/go.sum