Skip to content

Commit 3f2fb1c

Browse files
committed
feat: auto relock PR github action
1 parent 6e5b679 commit 3f2fb1c

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/relock.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Update and relock NPM packages
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# run Thursdays at 05:00 UTC
7+
- cron: '0 5 * * THU'
8+
9+
jobs:
10+
relock:
11+
name: Update and relock NPM packages and open PR if necessary
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v3
16+
with:
17+
ref: main
18+
19+
- name: Import Snyk Deployer GPG key
20+
uses: crazy-max/ghaction-import-gpg@v5
21+
with:
22+
gpg_private_key: ${{ secrets.GA_GPG_PRIVATE_KEY }}
23+
passphrase: ${{ secrets.GA_GPG_PRIVATE_KEY_PASS }}
24+
git_user_signingkey: true
25+
git_commit_gpgsign: true
26+
27+
- name: Run npm update
28+
run: |
29+
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > .npmrc
30+
npm update
31+
rm -f .npmrc
32+
33+
- name: Create Signed Commit
34+
id: create-commit
35+
run: |
36+
git add package*
37+
any_changes=$(git diff --cached)
38+
echo "::set-output name=changes::${any_changes}"
39+
if [[ ! -z "${any_changes}" ]]; then
40+
git commit -S -m "chore: update & relock NPM packages"
41+
fi
42+
43+
- name: Create Pull Request
44+
uses: peter-evans/create-pull-request@v4
45+
if: ${{ success() && steps.create-commit.outputs.changes != null}}
46+
with:
47+
token: ${{ secrets.DEPLOYER_GITHUB_TOKEN }}
48+
branch: chore/update-and-relock-npm-packages
49+
delete-branch: true
50+
title: 'chore: Update and relock NPM packages'
51+
body: |
52+
This PR updates and relocks NPM packages.
53+
54+
It is created by a recurring github action checking for outdated dependencies.

0 commit comments

Comments
 (0)