Skip to content

Commit

Permalink
存在する場合はPRを作らない
Browse files Browse the repository at this point in the history
  • Loading branch information
eatski committed Aug 8, 2024
1 parent 589edb9 commit fbbcc40
Showing 1 changed file with 4 additions and 20 deletions.
24 changes: 4 additions & 20 deletions .github/workflows/prepare-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,13 @@ jobs:
- name: Checkout repository
uses: actions/checkout@v4

- name: Fetch all branches
run: git fetch --all

- name: Check if there are changes between main and production
id: check_diff
- name: Create Pull Request
run: |
git checkout main
git pull origin main
git checkout production
git pull origin production
DIFF=$(git diff main production)
if [ -z "$DIFF" ]; then
echo "No changes detected."
echo "::set-output name=changes::false"
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 "Changes detected."
echo "::set-output name=changes::true"
echo "PR already exists between main and production."
fi
- name: Create Pull Request
if: steps.check_diff.outputs.changes == 'true'
run: |
gh pr create --title "Update production branch" --body "This PR updates the production branch with changes from main." --base production --head main
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit fbbcc40

Please sign in to comment.