Skip to content

Commit

Permalink
Merge pull request #95 from hirokiwa/94-automate-creation-of-prs-to-m…
Browse files Browse the repository at this point in the history
…ain-branch

94 automate creation of prs to main branch
  • Loading branch information
hirokiwa authored Dec 25, 2023
2 parents 29061f7 + 4c83c21 commit 32ccd4a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions .github/workflows/createPR.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Create a pull request for release.

on:
push:
branches: [ develop ]

jobs:
create-release-pr:
runs-on: ubuntu-latest

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

steps:
- uses: actions/checkout@v2

- name: Check if pr exists
id: check_pr
run: |
pr_title=${{ (github.ref == 'refs/heads/develop' && 'Develop') || '' }}
base_branch=${{ (github.ref == 'refs/heads/develop' && 'main') || 'develop' }}
echo "::set-output name=count::$(gh pr list -S ${pr_title}' in:title' -B $base_branch | wc -l)"
echo "::set-output name=pr_title::$pr_title"
echo "::set-output name=base_branch::$base_branch"
- name: Create release pr
if: ${{ steps.check_pr.outputs.count == 0 }}
run: |
gh pr create -B ${{ steps.check_pr.outputs.base_branch }} -t ${{ steps.check_pr.outputs.pr_title }} -b ""

0 comments on commit 32ccd4a

Please sign in to comment.