mirror of
https://github.com/cmderdev/cmder.git
synced 2026-06-17 07:11:05 +08:00
76 lines
3.4 KiB
YAML
76 lines
3.4 KiB
YAML
name: Update branches
|
|
|
|
# Controls when the action will run.
|
|
on:
|
|
# Triggers the workflow on push events for the development branch
|
|
push:
|
|
branches: [ master ]
|
|
|
|
# Allows you to run this workflow manually from the Actions tab
|
|
workflow_dispatch:
|
|
|
|
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
|
|
jobs:
|
|
# This job updates the development branch with the master branch
|
|
update-development:
|
|
# The type of runner that the job will run on
|
|
runs-on: ubuntu-latest
|
|
|
|
# Steps represent a sequence of tasks that will be executed as part of the job
|
|
steps:
|
|
# Checks-out the repository under $GITHUB_WORKSPACE, so the job can access it
|
|
- uses: actions/checkout@v6
|
|
with:
|
|
fetch-depth: 0 # fetch all history for all branches and tags
|
|
|
|
- name: Summary - Merge operation started
|
|
shell: bash
|
|
run: |
|
|
repo_url="${{ github.server_url }}/${{ github.repository }}"
|
|
source_branch_url="$repo_url/tree/master"
|
|
target_branch_url="$repo_url/tree/development"
|
|
actor_handle="${{ github.actor }}"
|
|
actor_label="@${actor_handle}"
|
|
actor_label="${actor_label//[/\\[}"
|
|
actor_label="${actor_label//]/\\]}"
|
|
actor_url="${{ github.server_url }}/${{ github.actor }}"
|
|
actor_avatar_url="${{ github.server_url }}/${{ github.actor }}.png?size=32"
|
|
commit_url="$repo_url/commit/${{ github.sha }}"
|
|
|
|
echo "## 🔀 Update Branches - Workflow Summary" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "### Merge Operation" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Property | Value |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| --- | --- |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Source Branch | [\`master\`]($source_branch_url) |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Target Branch | [\`development\`]($target_branch_url) |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Triggered by | [<img src='$actor_avatar_url' width=16 height=16 alt=avatar/> $actor_label]($actor_url) |" >> $GITHUB_STEP_SUMMARY
|
|
echo "| Commit | [\`${{ github.sha }}\`]($commit_url) |" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
|
|
# Runs a single command using the runners shell
|
|
- name: Merge master into development
|
|
run: |
|
|
git config user.name "${{ github.actor }}"
|
|
git config user.email "${{ github.actor }}@users.noreply.github.com"
|
|
git checkout development
|
|
git merge --no-ff master
|
|
git push origin development
|
|
|
|
- name: Summary - Merge completed
|
|
if: success()
|
|
shell: bash
|
|
run: |
|
|
repo_url="${{ github.server_url }}/${{ github.repository }}"
|
|
source_branch_url="$repo_url/tree/master"
|
|
target_branch_url="$repo_url/tree/development"
|
|
|
|
echo "### ✅ Merge Successful" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "The [\`master\`]($source_branch_url) branch has been successfully merged into [\`development\`]($target_branch_url)." >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "**Merge type:** No fast-forward merge" >> $GITHUB_STEP_SUMMARY
|
|
echo "" >> $GITHUB_STEP_SUMMARY
|
|
echo "> The [\`development\`]($target_branch_url) branch is now synchronized with the latest changes from [\`master\`]($source_branch_url)." >> $GITHUB_STEP_SUMMARY
|