mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-07 20:08:53 +00:00
70 lines
2.9 KiB
YAML
70 lines
2.9 KiB
YAML
name: Check merge to master
|
|
|
|
on:
|
|
pull_request_target:
|
|
types: [ opened, synchronize, reopened ]
|
|
branches:
|
|
- 3.3.x
|
|
|
|
jobs:
|
|
merge-check:
|
|
if: github.event_name == 'pull_request_target' && github.event.pull_request.base.ref == '3.3.x'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout the repository
|
|
uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0 # Ensure full history is fetched
|
|
|
|
- name: Set up Git user
|
|
run: |
|
|
git config --global user.name "github-actions"
|
|
git config --global user.email "github-actions@github.com"
|
|
|
|
- name: Fetch all branches
|
|
run: git fetch origin
|
|
|
|
- name: Simulate merging PR into 3.3.x
|
|
id: simulate_merge
|
|
run: |
|
|
git checkout 3.3.x
|
|
git fetch origin pull/${{ github.event.pull_request.number }}/head
|
|
git merge --no-ff FETCH_HEAD || exit 1
|
|
|
|
- name: Attempt to merge updated 3.3.x into master
|
|
id: merge_master
|
|
run: |
|
|
git checkout master
|
|
if git merge --no-ff 3.3.x --no-commit; then
|
|
echo "mergeable=true" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "mergeable=false" >> $GITHUB_OUTPUT
|
|
git merge --abort
|
|
fi
|
|
|
|
- name: Find Comment
|
|
uses: peter-evans/find-comment@v3
|
|
id: fc
|
|
with:
|
|
issue-number: ${{ github.event.pull_request.number }}
|
|
comment-author: 'github-actions[bot]'
|
|
body-includes: The attempt to merge branch `3.3.x` into `master` has completed
|
|
|
|
- name: Post comment on PR
|
|
if: always() # Ensure this step always runs, regardless of merge result
|
|
uses: peter-evans/create-or-update-comment@v4
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
issue-number: ${{ github.event.pull_request.number }}
|
|
comment-id: ${{ steps.fc.outputs.comment-id }}
|
|
edit-mode: replace
|
|
body: |
|
|
The attempt to merge branch `3.3.x` into `master` has completed after considering the changes in this PR.
|
|
|
|
- Merge result: ${{ steps.merge_master.outputs.mergeable == 'true' && 'Success ✅' || 'Conflict ❌' }}
|
|
|
|
${{ steps.merge_master.outputs.mergeable == 'true' && 'This PR is ready to be merged.' || 'A separate PR will be needed to merge `3.3.x` into `master`.' }}
|
|
|
|
- name: Mark job as succeeded
|
|
if: always()
|
|
run: echo "Merge check completed. Ignoring the result to avoid failed status."
|