-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (69 loc) · 3.01 KB
/
update-dependencies.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
---
name: Update dependencies for SimpleSAMLphp 2.2
on: workflow_dispatch
jobs:
build:
name: Update tools
runs-on: ['ubuntu-latest']
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
outputs:
packages_changed: ${{ steps.changes.outputs.packages_changed }}
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.ASSETS_COMMIT_TOKEN }}
ref: ${{ github.head_ref || github.ref_name }}
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
- name: Fetch changes
# Without fetching, we might miss new tags due to caching in Github Actions
run: git fetch --all
- uses: actions/setup-node@v4
with:
node-version: 18
- name: Install & build assets
run: |
npx npm-check-updates -u
# Make sure the lock-file is up to date before we run clean-install
npm install --package-lock-only
npm clean-install
npm audit fix
- name: Diff the changes after building
shell: pwsh
# Give an id to the step, so we can reference it later
id: changes
run: |
git add --all
$Diff = git diff --cached --name-only
# Check if the lock-file has changed
$PackageDiff = $Diff | Where-Object {
$_ -match '^package-lock.json'
}
echo "Changed files"
echo $PackageDiff
$HasPackageDiff = $PackageDiff.Length -gt 0
echo "($($PackageDiff.Length) changes)"
echo "packages_changed=$HasPackageDiff" >> $env:GITHUB_OUTPUT
- name: Add & Commit
uses: EndBug/add-and-commit@v9
if: ${{ steps.changes.outputs.packages_changed }}
with:
# The arguments for the `git add` command (see the paragraph below for more info)
# Default: '.'
add: "['package-lock.json']"
# Determines the way the action fills missing author name and email. Three options are available:
# - github_actor -> UserName <[email protected]>
# - user_info -> Your Display Name <[email protected]>
# - github_actions -> github-actions <email associated with the github logo>
# Default: github_actor
default_author: github_actions
# The message for the commit.
# Default: 'Commit from GitHub Actions (name of the workflow)'
message: "[skip ci] Auto-update developer-tools"
# The way the action should handle pathspec errors from the add and remove commands.
# Three options are available:
# - ignore -> errors will be logged but the step won't fail
# - exitImmediately -> the action will stop right away, and the step will fail
# - exitAtEnd -> the action will go on, every pathspec error will be logged at the end, the step will fail.
# Default: ignore
pathspec_error_handling: exitImmediately