Skip to content

Commit 579a68d

Browse files
authored
Merge pull request #298 from phpbb/add/merge_to_master
Add merge to master to documentation
2 parents dbccd92 + 57c520c commit 579a68d

File tree

1 file changed

+60
-0
lines changed

1 file changed

+60
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Merge 3.3.x into master
2+
3+
on:
4+
push:
5+
branches:
6+
- 3.3.x
7+
8+
jobs:
9+
merge-branch:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- uses: actions/create-github-app-token@v1
14+
id: app-token
15+
with:
16+
app-id: ${{ vars.MERGE_MASTER_APP_ID }}
17+
private-key: ${{ secrets.MERGE_MASTER_SECRET }}
18+
19+
- name: Checkout the repository
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0 # Fetch full history for proper merging
23+
ref: 3.3.x # Checkout the 3.3.x branch
24+
token: ${{ steps.app-token.outputs.token }}
25+
26+
- name: Fetch the latest commit information
27+
id: get-commit-info
28+
run: |
29+
# Get the latest commit SHA and its author details
30+
COMMIT_SHA=$(git rev-parse HEAD)
31+
COMMIT_AUTHOR_NAME=$(git log -1 --pretty=format:'%an' $COMMIT_SHA)
32+
COMMIT_AUTHOR_EMAIL=$(git log -1 --pretty=format:'%ae' $COMMIT_SHA)
33+
34+
# Save them as output for later steps
35+
echo "commit_sha=$COMMIT_SHA" >> $GITHUB_ENV
36+
echo "commit_author_name=$COMMIT_AUTHOR_NAME" >> $GITHUB_ENV
37+
echo "commit_author_email=$COMMIT_AUTHOR_EMAIL" >> $GITHUB_ENV
38+
39+
- name: Set up Git with the pull request author's info
40+
run: |
41+
git config --global user.name "${{ env.commit_author_name }}"
42+
git config --global user.email "${{ env.commit_author_email }}"
43+
44+
- name: Fetch all branches
45+
run: git fetch --all
46+
47+
- name: Merge 3.3.x into master
48+
run: |
49+
git checkout master
50+
if git merge --no-ff 3.3.x; then
51+
echo "merge_failed=false" >> $GITHUB_ENV
52+
else
53+
echo "merge_failed=true" >> $GITHUB_ENV
54+
fi
55+
56+
- name: Push changes to master if merge was successful
57+
if: env.merge_failed == 'false'
58+
run: git push origin master
59+
env:
60+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)