Skip to content

Commit 1ee78c9

Browse files
Update branch_name var
1 parent 3a205c3 commit 1ee78c9

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

.github/workflows/merge-to-stage.yml

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,40 @@ jobs:
1414
merge-to-stage:
1515
name: Merge to stage after approval
1616
environment: merge-to-stage
17-
runs-on: ubuntu-latest
17+
runs-on: [ self-hosted, ubuntu-latest-no-docker, developer-foundations ]
1818
steps:
19-
- id: set-vars
20-
name: Set branch name
21-
run: echo "branch_name=${{ github.event.pull_request.head.ref }}" >> $GITHUB_OUTPUT
2219
- name: Checkout
2320
uses: actions/checkout@v3
2421
with:
2522
fetch-depth: '0'
2623
- name: Check if branch is already merged
2724
id: is-merged
25+
env:
26+
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
2827
run: |
2928
git fetch origin stage
30-
git fetch origin ${{ steps.set-vars.outputs.branch_name }}
31-
if git merge-base --is-ancestor origin/${{ steps.set-vars.outputs.branch_name }} origin/stage; then
29+
git fetch origin ${{ BRANCH_NAME }}
30+
if git merge-base --is-ancestor origin/${{ BRANCH_NAME }} origin/stage; then
3231
echo "Branch already merged to stage with no diff. Skipping remaining steps."
3332
echo "skip_merge=true" >> $GITHUB_OUTPUT
3433
fi
3534
- name: Merge to stage
3635
id: merge-to-stage
36+
env:
37+
BRANCH_NAME: ${{ github.event.pull_request.head.ref }}
3738
if: steps.is-merged.outputs.skip_merge != 'true'
3839
run: |
3940
git --version
4041
git config --global user.name "$(git log -n1 --pretty=format:'%an')"
4142
git config --global user.email "$(git log -n1 --pretty=format:'%ae')"
4243
git checkout stage
43-
git fetch origin ${{ steps.set-vars.outputs.branch_name }}
44-
git merge --no-ff --no-edit origin/"${{ steps.set-vars.outputs.branch_name }}"
44+
git fetch origin ${{ BRANCH_NAME }}
45+
git merge --no-ff --no-edit origin/"${{ BRANCH_NAME }}"
4546
git push
4647
- name: Login GH CLI tool
4748
if: steps.is-merged.outputs.skip_merge != 'true'
4849
run: echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --hostname ${GITHUB_SERVER_URL/https:\/\//} --with-token
4950
- name: Tag pull request
5051
if: steps.is-merged.outputs.skip_merge != 'true'
5152
run: |
52-
gh pr edit ${{ github.event.pull_request.number }} --add-label "in stage"
53+
gh pr edit ${{ github.event.pull_request.number }} --add-label "in stage"

0 commit comments

Comments
 (0)