Check for OpenMRS Dependency Updates #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
workflow_dispatch: | |
schedule: | |
# every hour | |
- cron: '30 * * * *' | |
name: 'Check for OpenMRS Dependency Updates' | |
jobs: | |
check-for-updates: | |
name: Check for updates to OpenMRS libraries | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
if: github.repository_owner == 'openmrs' | |
steps: | |
- uses: actions/checkout@v4 | |
- name: 🟢 Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
- name: 💾 Cache dependencies | |
id: cache | |
uses: actions/cache@v4 | |
with: | |
path: '**/node_modules' | |
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | |
- name: 📦 Install dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: yarn install --immutable | |
- name: ✅ Check for updates | |
run: node ./tools/update-openmrs-deps.mjs | |
- name: ⬆️ Create PR if necessary | |
id: cpr | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
commit-message: '(chore) Update OpenMRS dependencies' | |
title: '(chore) Update OpenMRS dependencies' | |
body: | | |
Update OpenMRS dependencies | |
branch: 'chore/update-openmrs-deps' | |
author: 'OpenMRS Bot <infrastructure@openmrs.org>' | |
token: ${{ secrets.OMRS_BOT_GH_TOKEN }} | |
- name: ✅ Auto approve PR | |
if: steps.cpr.outputs.pull-request-operation == 'created' || steps.cpr.outputs.pull-request-operation == 'updated' | |
run: gh pr review --approve "${{ steps.cpr.outputs.pull-request-number }}" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: 🔀 Automerge PR | |
if: steps.cpr.outputs.pull-request-operation == 'created' || steps.cpr.outputs.pull-request-operation == 'updated' | |
run: gh pr merge --auto --squash "${{ steps.cpr.outputs.pull-request-number }}" | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |