forked from github/plane
fix: auto merge fixes
This commit is contained in:
parent
4861be2773
commit
3f1ce9907d
33
.github/workflows/auto-merge.yml
vendored
33
.github/workflows/auto-merge.yml
vendored
@ -8,10 +8,10 @@ on:
|
||||
|
||||
env:
|
||||
CURRENT_BRANCH: ${{ github.ref_name }}
|
||||
SOURCE_BRANCH: ${{ secrets.SYNC_TARGET_BRANCH_NAME }} # The sync branch such as "sync/ce"
|
||||
TARGET_BRANCH: ${{ secrets.TARGET_BRANCH }} # The target branch that you would like to merge changes like develop
|
||||
SOURCE_BRANCH: ${{ secrets.SYNC_SOURCE_BRANCH_NAME }} # The sync branch such as "sync/ce"
|
||||
TARGET_BRANCH: ${{ secrets.SYNC_TARGET_BRANCH_NAME }} # The target branch that you would like to merge changes like develop
|
||||
GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} # Personal access token required to modify contents and workflows
|
||||
REVIEWER: ${{ secrets.REVIEWER }}
|
||||
REVIEWER: ${{ secrets.SYNC_PR_REVIEWER }}
|
||||
|
||||
jobs:
|
||||
Check_Branch:
|
||||
@ -41,6 +41,11 @@ jobs:
|
||||
with:
|
||||
fetch-depth: 0 # Fetch all history for all branches and tags
|
||||
|
||||
- name: Setup Git
|
||||
run: |
|
||||
git config user.name "GitHub Actions"
|
||||
git config user.email "actions@github.com"
|
||||
|
||||
- name: Setup GH CLI and Git Config
|
||||
run: |
|
||||
type -p curl >/dev/null || (sudo apt update && sudo apt install curl -y)
|
||||
@ -50,20 +55,6 @@ jobs:
|
||||
sudo apt update
|
||||
sudo apt install gh -y
|
||||
|
||||
- id: git-author
|
||||
name: Setup Git CLI from Github Token
|
||||
run: |
|
||||
VIEWER_JSON=$(gh api graphql -f query='query { viewer { name login databaseId }}' --jq '.data.viewer')
|
||||
VIEWER_NAME=$(jq --raw-output '.name | values' <<< "${VIEWER_JSON}")
|
||||
VIEWER_LOGIN=$(jq --raw-output '.login' <<< "${VIEWER_JSON}")
|
||||
VIEWER_DATABASE_ID=$(jq --raw-output '.databaseId' <<< "${VIEWER_JSON}")
|
||||
|
||||
USER_NAME="${VIEWER_NAME:-${VIEWER_LOGIN}}"
|
||||
USER_EMAIL="${VIEWER_DATABASE_ID}+${VIEWER_LOGIN}@users.noreply.github.com"
|
||||
|
||||
git config --global user.name ${USER_NAME}
|
||||
git config --global user.email ${USER_EMAIL}
|
||||
|
||||
- name: Check for merge conflicts
|
||||
id: conflicts
|
||||
run: |
|
||||
@ -88,10 +79,6 @@ jobs:
|
||||
- name: Create PR to Target Branch
|
||||
if: env.HAS_CONFLICTS == 'true'
|
||||
run: |
|
||||
# Use GitHub CLI to create PR and specify author and committer
|
||||
PR_URL=$(gh pr create --base $TARGET_BRANCH --head $SOURCE_BRANCH \
|
||||
--title "sync: merge conflicts need to be resolved" \
|
||||
--body "" \
|
||||
--reviewer $REVIEWER )
|
||||
# Replace 'username' with the actual GitHub username of the reviewer.
|
||||
PR_URL=$(gh pr create --base $TARGET_BRANCH --head $SOURCE_BRANCH --title "sync: merge conflicts need to be resolved" --body "" --reviewer $REVIEWER)
|
||||
echo "Pull Request created: $PR_URL"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user