Skip to content

Commit

Permalink
fix: auto-merge CI 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
useonglee committed Dec 14, 2023
1 parent 453fc79 commit c179ce2
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions .github/workflows/auto-merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,22 @@ jobs:

- name: Check if approved
id: check_approval
run: echo "approved=${{ github.event.review.state == 'approved' }}" >> $GITHUB_OUTPUT

- name: Squash merge if approved
run: |
if [[ "${{ github.event.review.state }}" == "approved" ]]; then
echo "::set-output name=approved::true"
else
echo "::set-output name=approved::false"
fi
shell: bash

- name: Setup GitHub CLI
if: steps.check_approval.outputs.approved == 'true'
run: |
echo "Head ref: ${{ github.event.pull_request.head.ref }}"
git fetch origin ${{ github.event.pull_request.head.ref }}
git checkout ${{ github.event.pull_request.head.ref }}
git merge --squash ${{ github.event.pull_request.base.ref }}
gh auth login --with-token <<< "${{ secrets.GH_TOKEN }}"
shell: bash

git commit -m "${{ github.event.pull_request.title}}"
git push origin ${{ github.event.pull_request.head.ref }}
- name: Auto merge
- name: Squash merge if approved
if: steps.check_approval.outputs.approved == 'true'
run: |
gh pr merge ${{ github.event.number }} --squash --auto
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
gh pr merge ${{ github.event.pull_request.number }} --squash --auto
shell: bash

0 comments on commit c179ce2

Please sign in to comment.