存在する場合はPRを作らない #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create PR from main to production | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
create-pr: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Create Pull Request | |
run: | | |
if [ $(gh pr list --head main --base production --json number --jq '. | length') -eq 0 ]; then | |
gh pr create --title "New PR from main to production" --body "This PR is automatically created by the script" --head main --base production | |
else | |
echo "PR already exists between main and production." | |
fi | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |