Skip to content

Update dependency On-Demand #167

Update dependency On-Demand

Update dependency On-Demand #167

Workflow file for this run

# 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 }}"