Compare commits

...
Author SHA1 Message Date
MickLesk 109b04efbf Merge only the changelog pull request the job opened
Look the pull request up among this repository's own branches and merge
only the commit the job pushed.
2026-11-17 14:16:54 +01:00
2 changed files with 12 additions and 10 deletions

No files matched your search

+5 -4
View File
@@ -324,13 +324,14 @@ jobs:
git commit -m "Archive old changelog entries"
git checkout -b $BRANCH_NAME || git checkout $BRANCH_NAME
git push origin $BRANCH_NAME --force
echo "HEAD_SHA=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
- name: Create pull request if not exists
if: env.changed == 'true'
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
PR_EXISTS=$(gh pr list --head "${BRANCH_NAME}" --json number --jq '.[].number')
PR_EXISTS=$(gh pr list --head "${BRANCH_NAME}" --state open --json number,isCrossRepository --jq '[.[] | select(.isCrossRepository == false)][0].number // empty')
if [ -z "$PR_EXISTS" ]; then
gh pr create --title "[Github Action] Archive old changelog entries" \
--body "This PR is auto-generated by a Github Action to archive old changelog entries (older than 14 days) to .github/changelogs/YEAR/MONTH.md" \
@@ -346,8 +347,8 @@ jobs:
run: |
git config --global user.name "github-actions-automege[bot]"
git config --global user.email "github-actions-automege[bot]@users.noreply.github.com"
PR_NUMBER=$(gh pr list --head "${BRANCH_NAME}" --json number --jq '.[].number')
PR_NUMBER=$(gh pr list --head "${BRANCH_NAME}" --state open --json number,isCrossRepository --jq '[.[] | select(.isCrossRepository == false)][0].number // empty')
if [ -n "$PR_NUMBER" ]; then
gh pr review $PR_NUMBER --approve
gh pr merge $PR_NUMBER --squash --admin
gh pr review "$PR_NUMBER" --approve
gh pr merge "$PR_NUMBER" --squash --admin --match-head-commit "$HEAD_SHA"
fi
+7 -6
View File
@@ -349,13 +349,14 @@ jobs:
git commit -m "Update CHANGELOG.md"
git checkout -b $BRANCH_NAME || git checkout $BRANCH_NAME
git push origin $BRANCH_NAME --force
echo "HEAD_SHA=$(git rev-parse HEAD)" >> "$GITHUB_ENV"
- name: Create pull request if not exists
if: env.changed == 'true'
env:
GH_TOKEN: ${{ steps.generate-token.outputs.token }}
run: |
PR_EXISTS=$(gh pr list --head "${BRANCH_NAME}" --json number --jq '.[].number')
PR_EXISTS=$(gh pr list --head "${BRANCH_NAME}" --state open --json number,isCrossRepository --jq '[.[] | select(.isCrossRepository == false)][0].number // empty')
if [ -z "$PR_EXISTS" ]; then
gh pr create --title "[Github Action] Update CHANGELOG.md" \
--body "This PR is auto-generated by a Github Action to update the CHANGELOG.md file." \
@@ -369,9 +370,9 @@ jobs:
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
PR_NUMBER=$(gh pr list --head "${BRANCH_NAME}" --json number --jq '.[].number')
PR_NUMBER=$(gh pr list --head "${BRANCH_NAME}" --state open --json number,isCrossRepository --jq '[.[] | select(.isCrossRepository == false)][0].number // empty')
if [ -n "$PR_NUMBER" ]; then
gh pr review $PR_NUMBER --approve
gh pr review "$PR_NUMBER" --approve
fi
- name: Approve pull request and merge
@@ -381,8 +382,8 @@ jobs:
run: |
git config --global user.name "github-actions-automege[bot]"
git config --global user.email "github-actions-automege[bot]@users.noreply.github.com"
PR_NUMBER=$(gh pr list --head "${BRANCH_NAME}" --json number --jq '.[].number')
PR_NUMBER=$(gh pr list --head "${BRANCH_NAME}" --state open --json number,isCrossRepository --jq '[.[] | select(.isCrossRepository == false)][0].number // empty')
if [ -n "$PR_NUMBER" ]; then
gh pr review $PR_NUMBER --approve
gh pr merge $PR_NUMBER --squash --admin
gh pr review "$PR_NUMBER" --approve
gh pr merge "$PR_NUMBER" --squash --admin --match-head-commit "$HEAD_SHA"
fi