Skip to content

chore: update mcp latest version to 1.26.0 #98

chore: update mcp latest version to 1.26.0

chore: update mcp latest version to 1.26.0 #98

name: Validate Backport
on:
pull_request_target:
types:
- labeled
jobs:
validate-backport:
name: Validate Backport
runs-on: ubuntu-latest
permissions:
pull-requests: write
if: >
github.event.action == 'labeled' && contains(github.event.label.name, 'backport')
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
fetch-depth: 0
- name: Check Conflicts
env:
BACKPORT_LABEL: ${{ github.event.label.name }}
PR_BRANCH: ${{ github.head_ref }}
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
id: backport_validation
run: |
git config --global user.name "${GITHUB_ACTOR}"
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
TARGET_BRANCH=$(echo "${BACKPORT_LABEL}" | awk '{ print $NF }')
MERGE_BASE=$(git merge-base origin/main origin/${PR_BRANCH})
HEAD_HASH=$(git rev-parse origin/${PR_BRANCH})
git diff ${HEAD_HASH} ${MERGE_BASE} > ../backport.patch
cat ../backport.patch
git checkout origin/${TARGET_BRANCH}
ERROR=$(git apply ../backport.patch 2>&1) || true
echo "results<<EOF" >> "$GITHUB_OUTPUT"
if [[ ! -z ${ERROR} ]]
then
echo "This change is marked for backport to ${TARGET_BRANCH}, but it conflicts with that branch." | tee -a "$GITHUB_OUTPUT"
echo "Attempting to apply this change as a patch to ${TARGET_BRANCH} yielded the following error:" | tee -a "$GITHUB_OUTPUT"
echo "\`\`\`" >> "$GITHUB_OUTPUT"
echo "$ERROR" | tee -a "$GITHUB_OUTPUT"
echo "\`\`\`" >> "$GITHUB_OUTPUT"
else
echo "This change is marked for backport to ${TARGET_BRANCH} and it does not conflict with that branch." | tee -a "$GITHUB_OUTPUT"
fi
echo "The patch used to test backporting was" | tee -a "$GITHUB_OUTPUT"
echo "\`\`\`" >> "$GITHUB_OUTPUT"
echo "git diff ${HEAD_HASH} ${MERGE_BASE}" | tee -a "$GITHUB_OUTPUT"
echo "\`\`\`" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"
- name: Comment PR
uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
file-path: comment.txt
message: |
${{ steps.backport_validation.outputs.results }}