Skip to content

Commit

Permalink
ci: add workflow to check if versioning pr exists
Browse files Browse the repository at this point in the history
  • Loading branch information
sahani-deriv committed Jun 26, 2024
1 parent d45e7f7 commit 3e3522e
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions .github/workflows/check_versioning_pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
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@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "14"

- name: Check if PR with title chore(version) exists
uses: actions/github-script@v6
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.");
}
- name: Fail if PR exists
if: steps.check-pr.outputs.exists == 'true'
run: |
echo "Version bump pull request exists. Please merge that pr first to pass the check."
exit 1

0 comments on commit 3e3522e

Please sign in to comment.