nocobase/.github/workflows/auto-merge.yml

56 lines
2.0 KiB
YAML
Raw Normal View History

name: Auto merge main -> next
2024-07-16 08:13:24 +00:00
concurrency:
2024-10-18 04:57:45 +00:00
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event.inputs.repository }}
2024-07-16 08:13:24 +00:00
cancel-in-progress: true
on:
2024-10-18 04:57:45 +00:00
workflow_dispatch:
inputs:
repository:
description: 'Please enter a repository name'
2024-07-16 08:13:24 +00:00
push:
branches:
- 'main'
jobs:
push-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/create-github-app-token@v1
id: app-token
with:
app-id: ${{ vars.NOCOBASE_APP_ID }}
private-key: ${{ secrets.NOCOBASE_APP_PRIVATE_KEY }}
2024-10-18 05:29:25 +00:00
repositories: nocobase,pro-plugins,plugin-pro-tpl,${{ join(fromJSON(vars.NEXT_PRO_PLUGIN_REPOS), ',') }},${{ join(fromJSON(vars.CUSTOM_PRO_PLUGIN_REPOS), ',') }}
skip-token-revoke: true
- name: Get GitHub App User ID
id: get-user-id
run: echo "user-id=$(gh api "/users/${{ steps.app-token.outputs.app-slug }}[bot]" --jq .id)" >> "$GITHUB_OUTPUT"
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
2024-07-16 08:13:24 +00:00
- name: Checkout
uses: actions/checkout@v4
with:
2024-10-18 04:57:45 +00:00
repository: nocobase/${{ inputs.repository || 'nocobase' }}
token: ${{ steps.app-token.outputs.token }}
2024-07-16 08:13:24 +00:00
persist-credentials: true
fetch-depth: 0
2024-10-18 05:01:37 +00:00
- name: main -> next(${{ inputs.repository || 'nocobase' }})
2024-07-16 08:13:24 +00:00
run: |
git config --global user.name '${{ steps.app-token.outputs.app-slug }}[bot]'
git config --global user.email '${{ steps.get-user-id.outputs.user-id }}+${{ steps.app-token.outputs.app-slug }}[bot]@users.noreply.github.com>'
2024-07-16 08:13:24 +00:00
git checkout main
git pull origin main
git checkout next
git merge main
git push origin next
2024-10-18 05:01:37 +00:00
- name: push ${{ inputs.repository || 'nocobase' }}(next)
2024-07-16 08:13:24 +00:00
uses: ad-m/github-push-action@master
with:
branch: next
2024-10-13 04:08:35 +00:00
github_token: ${{ steps.app-token.outputs.token }}
2024-10-18 05:01:37 +00:00
repository: nocobase/${{ inputs.repository || 'nocobase' }}
2024-07-16 08:13:24 +00:00
tags: true
atomic: true