fix: update-workflow #16
This file contains hidden or 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 master to main | |
| on: | |
| push: | |
| branches: | |
| - master | |
| jobs: | |
| create-pull-request: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| ref: master | |
| - name: Check if main and master are different | |
| id: check-diff | |
| run: | | |
| git fetch origin main:main | |
| DIFF_COUNT=$(git rev-list --count main..master) | |
| echo "diff_count=$DIFF_COUNT" >> $GITHUB_OUTPUT | |
| if [ "$DIFF_COUNT" -gt 0 ]; then | |
| echo "Differences found between main and master. Will create PR." | |
| else | |
| echo "No differences found between main and master. Skipping PR creation." | |
| fi | |
| - name: Create Pull Request | |
| if: steps.check-diff.outputs.diff_count > 0 | |
| uses: peter-evans/create-pull-request@v5 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| commit-message: Auto PR from master to main | |
| title: Merge master into main | |
| body: | | |
| This is an automated PR to merge changes from master into main branch. | |
| Changes included in this PR: | |
| ${{ github.event.commits[0].message }} | |
| branch: auto-pr-master-to-main | |
| base: main | |
| delete-branch: true |