-
Notifications
You must be signed in to change notification settings - Fork 258
55 lines (52 loc) · 1.93 KB
/
update-openmrs-deps.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
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 }}