-
-
Notifications
You must be signed in to change notification settings - Fork 202
71 lines (64 loc) · 2.24 KB
/
update-dep.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
# Update a dependency On-Demand
name: Update dependency On-Demand
on:
workflow_dispatch:
inputs:
dep:
description: 'Dependency'
required: true
default: 'zwave-js'
version:
description: 'Version'
required: false
default: ''
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 20.x
cache: 'npm'
- name: Update dependency
run: |
npm install ${{github.event.inputs.dep}}@${{github.event.inputs.version || 'latest'}}
- name: Check for changes
id: check
run: |
git diff --name-only || true
if ! git diff --quiet ; then
echo "Has changes"
echo "changed=true" >> $GITHUB_OUTPUT
VERSION=$(npm info ${{github.event.inputs.dep}} version)
echo "version=$VERSION" >> $GITHUB_OUTPUT
else
echo "No changes detected. Dependency already up to date"
echo "changed=false" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
if: ${{ steps.check.outputs.changed == 'true' }}
id: cpr
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.BOT_TOKEN }}
commit-message: "feat: bump ${{github.event.inputs.dep}}@${{ steps.check.outputs.version }}"
committer: Z-Wave JS Bot <bot@zwave-js.io>
author: Z-Wave JS Bot <bot@zwave-js.io>
signoff: false
branch: "${{github.event.inputs.dep}}@${{ steps.check.outputs.version }}"
delete-branch: true
title: "feat: bump ${{github.event.inputs.dep}}@${{ steps.check.outputs.version }}"
body: |
Update ${{github.event.inputs.dep}} to version ${{ steps.check.outputs.version }}
labels: |
dependencies
workflow-bump
base: master
draft: false
- name: Check outputs
if: ${{ steps.check.outputs.changed == 'true' }}
run: |
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"