-
Notifications
You must be signed in to change notification settings - Fork 2
37 lines (31 loc) · 1.22 KB
/
check_versioning_pr.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
name: versioning_pr_exists
on:
pull_request:
types: [opened, edited, reopened, synchronize]
jobs:
check-version-pr:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11
- name: Set up Node.js
uses: actions/setup-node@eff380dfbcf941bf8832e4acb788cebe13dfd758
with:
node-version: "14"
- name: Check if PR with title chore(version) exists
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
github-token: ${{ secrets.PAT }}
script: |
const { data: pullRequests } = await github.rest.pulls.list({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
per_page: 100
});
const existingPR = pullRequests.find(pr => pr.title === 'chore(version): bump version and update changelog');
if (existingPR) {
core.setFailed(`Version bump pull request exists. Please merge that pr first to pass the check.: #${existingPR.number}`);
} else {
console.log("No version bump pull request found.");
}