Skip to content

Commit c246f87

Browse files
(chore) Create a github action workflow to open release PRs
1 parent e71d9c5 commit c246f87

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
name: 'Open Release PR'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_type:
7+
description: 'Release type'
8+
required: true
9+
type: choice
10+
options:
11+
- major
12+
- minor
13+
- patch
14+
default: minor
15+
16+
permissions:
17+
contents: write
18+
pull-requests: write
19+
20+
jobs:
21+
release:
22+
runs-on: ubuntu-latest
23+
24+
steps:
25+
- name: Checkout repository
26+
uses: actions/checkout@v4
27+
with:
28+
# Fetch full history so tools that read tags/changelog (if any) work
29+
fetch-depth: 0
30+
31+
- name: Setup Node.js
32+
uses: actions/setup-node@v4
33+
with:
34+
node-version: 20
35+
36+
- name: 💾 Cache dependencies
37+
id: cache
38+
uses: actions/cache@v4
39+
with:
40+
path: '**/node_modules'
41+
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }}
42+
43+
- name: 📦 Install dependencies if cache miss
44+
if: steps.cache.outputs.cache-hit != 'true'
45+
run: yarn install --immutable
46+
47+
- name: Run release
48+
run: yarn version ${{ inputs.release_type }}
49+
50+
- name: Create PR with release changes
51+
id: cpr
52+
uses: peter-evans/create-pull-request@v7
53+
env:
54+
HUSKY: 0
55+
with:
56+
# branch name is unique per run
57+
branch: "release/${{ inputs.release_type }}-${{ github.run_id }}"
58+
commit-message: "chore(release): ${{ inputs.release_type }} version bump"
59+
title: "(chore): Release ${{ inputs.release_type }} version"
60+
body: |
61+
This PR was created automatically via **workflow_dispatch**.
62+
63+
**Command run**
64+
```
65+
yarn release ${{ inputs.release_type }}
66+
```
67+
68+
Please review the changes (version bumps, changelog, etc.) and merge. :)
69+
labels: |
70+
release
71+
automated-pr
72+
delete-branch: true
73+
author: "OpenMRS Bot <infrastructure@openmrs.org>"
74+
committer: "OpenMRS Bot <infrastructure@openmrs.org>"
75+
token: ${{ secrets.OMRS_BOT_GH_TOKEN || secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)