mirror of
https://github.com/PrismLauncher/PrismLauncher.git
synced 2026-06-29 01:54:20 +03:00
ci: automatically merge major and minor release branches
Signed-off-by: Seth Flynn <getchoo@tuta.io>
This commit is contained in:
parent
f476b2b726
commit
c3b26478a6
2 changed files with 89 additions and 0 deletions
54
.github/actions/merge-branches/action.yml
vendored
Normal file
54
.github/actions/merge-branches/action.yml
vendored
Normal file
|
|
@ -0,0 +1,54 @@
|
||||||
|
name: Merge Branches
|
||||||
|
description: Merge two sets of branches automatically
|
||||||
|
|
||||||
|
inputs:
|
||||||
|
base:
|
||||||
|
description: Base branch to merge into
|
||||||
|
required: true
|
||||||
|
head:
|
||||||
|
description: Head branch to merge
|
||||||
|
required: true
|
||||||
|
token:
|
||||||
|
description: GitHub token used to query the API
|
||||||
|
|
||||||
|
outputs:
|
||||||
|
base:
|
||||||
|
description: Base branch to merge into
|
||||||
|
value: ${{ inputs.base }}
|
||||||
|
head:
|
||||||
|
description: Head branch to merge
|
||||||
|
value: ${{ inputs.head }}
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: composite
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Compare branches
|
||||||
|
id: compare
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
BASE: ${{ inputs.base }}
|
||||||
|
HEAD: ${{ inputs.head }}
|
||||||
|
GH_TOKEN: ${{ inputs.token }}
|
||||||
|
run: |
|
||||||
|
status="$(gh api "/repos/$GITHUB_REPOSITORY/compare/$BASE...$HEAD" --jq '.status')"
|
||||||
|
echo "status=$status" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Skip merge if branches are identical
|
||||||
|
if: ${{ steps.compare.outputs.status == 'identical' }}
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
echo "Base and head branches are identical. Skipping merge." >&2
|
||||||
|
|
||||||
|
- name: Merge branches
|
||||||
|
if: ${{ steps.compare.outputs.status != 'identical' }}
|
||||||
|
shell: bash
|
||||||
|
env:
|
||||||
|
BASE: ${{ inputs.base }}
|
||||||
|
HEAD: ${{ inputs.head }}
|
||||||
|
GH_TOKEN: ${{ inputs.token }}
|
||||||
|
run: |
|
||||||
|
gh api "/repos/$GITHUB_REPOSITORY/merges" \
|
||||||
|
-F base="$BASE" \
|
||||||
|
-F head="$HEAD" \
|
||||||
|
-F commit_message="chore: automatic merge of $HEAD into $BASE"
|
||||||
35
.github/workflows/merge-release-branches.yml
vendored
Normal file
35
.github/workflows/merge-release-branches.yml
vendored
Normal file
|
|
@ -0,0 +1,35 @@
|
||||||
|
name: Automatically merge release branches
|
||||||
|
|
||||||
|
on:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 */4 * * *'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
permissions: {}
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
merge:
|
||||||
|
name: Merge (${{ matrix.head }} -> ${{ matrix.base }})
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- base: release-10.x
|
||||||
|
head: release-10.0.x
|
||||||
|
|
||||||
|
runs-on: ubuntu-slim
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Check and merge branches
|
||||||
|
uses: ./.github/actions/merge-branches
|
||||||
|
with:
|
||||||
|
base: ${{ matrix.base }}
|
||||||
|
head: ${{ matrix.head }}
|
||||||
|
token: ${{ github.token }}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue