-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.yaml
46 lines (46 loc) · 1.47 KB
/
action.yaml
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
name: Update Hugo Modules
branding:
icon: arrow-up-circle
color: purple
description: |
Run `hugo mod get -u` against a project and return what updates were made, if any.
inputs:
recursive:
description: Whether or not to update the modules recursively
required: false
default: 'true'
no-install:
description: Specify to skip the hugo install step
required: false
default: 'false'
outputs:
results:
description: |
The output returned from `hugo mod get -u` explaining what it did.
value: "${{ steps.update-hugo-modules.outputs.results }}"
runs:
using: composite
steps:
- name: Setup Hugo
if: ${{ inputs.no-install != 'true' }}
uses: peaceiris/actions-hugo@v2
with:
hugo-version: 'latest'
extended: true
- name: Update Modules
id: update-hugo-modules
shell: pwsh
run: |
$UpdateArgument = ('${{ inputs.recursive }}' -eq 'true') ? './...' : ''
$UpdateLines = Invoke-Command { hugo mod get -u $UpdateArgument 2>&1 } |
ForEach-Object { $_.ToString() } |
Where-Object -FilterScript {
# Skip generic update line
$_.ToString() -notmatch '^Update module in'
}
If ($UpdateLines -match '(error|failed to execute)') {
Throw "Something went wrong!`r`n$UpdateLines"
} Else {
$UpdateLines = $UpdateLines -join "`r`n" | ConvertTo-Json
}
echo "::set-output name=results::$UpdateLines"