From e879d6e66c623c371c9c6e833b018705784f83d7 Mon Sep 17 00:00:00 2001 From: hagaitski Date: Thu, 8 Aug 2024 16:12:24 +0900 Subject: [PATCH] =?UTF-8?q?PR=E4=BD=9C=E6=88=90WF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/prepare-release.yaml | 45 ++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/prepare-release.yaml diff --git a/.github/workflows/prepare-release.yaml b/.github/workflows/prepare-release.yaml new file mode 100644 index 00000000..48bf1da0 --- /dev/null +++ b/.github/workflows/prepare-release.yaml @@ -0,0 +1,45 @@ +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@v3 + + - name: Fetch all branches + run: git fetch --all + + - name: Check if there are changes between main and production + id: check_diff + 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" + else + echo "Changes detected." + echo "::set-output name=changes::true" + fi + + - name: Create Pull Request + if: steps.check_diff.outputs.changes == 'true' + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.GITHUB_TOKEN }} + source: main + destination: production + title: 'Update production branch' + body: 'This PR updates the production branch with changes from the main branch.' + draft: false + base: production + branch: main