Fix runs-on #11
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: Merge to stage after approval | ||
|
Check failure on line 1 in .github/workflows/merge-to-stage.yml
|
||
| run-name: "[Merge to stage] ${{ github.event.pull_request.title}}" | ||
| on: | ||
| pull_request_target: | ||
| permissions: | ||
| id-token: write | ||
| contents: write | ||
| actions: write | ||
| pull-requests: write | ||
| jobs: | ||
| merge-to-stage: | ||
| name: Merge to stage after approval | ||
| environment: merge-to-stage | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v3 | ||
| with: | ||
| fetch-depth: '0' | ||
| - name: Check if branch is already merged | ||
| id: is-merged | ||
| env: | ||
| BRANCH_NAME: ${{ github.event.pull_request.head.ref }} | ||
| run: | | ||
| git fetch origin stage | ||
| git fetch origin ${{ BRANCH_NAME }} | ||
| if git merge-base --is-ancestor origin/${{ BRANCH_NAME }} origin/stage; then | ||
| echo "Branch already merged to stage with no diff. Skipping remaining steps." | ||
| echo "skip_merge=true" >> $GITHUB_OUTPUT | ||
| fi | ||
| - name: Merge to stage | ||
| id: merge-to-stage | ||
| env: | ||
| BRANCH_NAME: ${{ github.event.pull_request.head.ref }} | ||
| if: steps.is-merged.outputs.skip_merge != 'true' | ||
| run: | | ||
| git --version | ||
| git config --global user.name "$(git log -n1 --pretty=format:'%an')" | ||
| git config --global user.email "$(git log -n1 --pretty=format:'%ae')" | ||
| git checkout stage | ||
| git fetch origin ${{ BRANCH_NAME }} | ||
| git merge --no-ff --no-edit origin/"${{ BRANCH_NAME }}" | ||
| git push | ||
| - name: Login GH CLI tool | ||
| if: steps.is-merged.outputs.skip_merge != 'true' | ||
| run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --hostname ${GITHUB_SERVER_URL/https:\/\//} --with-token | ||
| - name: Tag pull request | ||
| if: steps.is-merged.outputs.skip_merge != 'true' | ||
| run: | | ||
| gh pr edit ${{ github.event.pull_request.number }} --add-label "in stage" | ||