fix(ci): fix ci script error for pro (#4845)

* fix(ci): fix ci script error on pro

* fix(ci): fix ci script

* feat(ci): add base branch input for main repo

* test(ci): test pr branch number

* test(ci): test pr branch number
This commit is contained in:
Junyi 2024-07-08 22:13:35 +08:00 committed by GitHub
parent fb8ff62d01
commit e4b3546583
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -7,6 +7,10 @@ concurrency:
on: on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
base_branch:
description: 'Please enter a base branch for main repo'
required: true
default: 'main'
pr_number: pr_number:
description: 'Please enter a pull request number' description: 'Please enter a pull request number'
required: true required: true
@ -24,14 +28,21 @@ jobs:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
ref: ${{ github.event.inputs.base_branch }}
ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }} ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }}
submodules: true submodules: true
- name: Set PR branch
id: set_pro_pr_branch
if: inputs.pr_number != 'main'
run: echo "pr_branch=refs/pull/${{ github.event.inputs.pr_number }}/head" >> $GITHUB_OUTPUT
- name: Echo PR branch
run: echo "${{ steps.set_pro_pr_branch.outputs.pr_branch }}"
- name: Checkout pro-plugins - name: Checkout pro-plugins
uses: actions/checkout@v3 uses: actions/checkout@v3
with: with:
repository: nocobase/pro-plugins repository: nocobase/pro-plugins
path: packages/pro-plugins path: packages/pro-plugins
ref: ${{ inputs.pr_number != 'main' && 'refs/pull/' + inputs.pr_number + '/head' || 'main' }} ref: ${{ steps.set_pro_pr_branch.outputs.pr_branch || 'main' }}
ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }} ssh-key: ${{ secrets.SUBMODULE_SSH_KEY }}
- name: rm .git - name: rm .git
run: rm -rf packages/pro-plugins/.git && git config --global user.email "you@example.com" && git config --global user.name "Your Name" && git add -A && git commit -m "tmp commit" run: rm -rf packages/pro-plugins/.git && git config --global user.email "you@example.com" && git config --global user.name "Your Name" && git add -A && git commit -m "tmp commit"