File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 77 required : true
88 type : string
99env :
10+ repository : ${{ github.repository }} # 可以指定独立的仓库
1011 main_branch : ${{ github.ref }}
1112 cd_branch_prefix : ${{ github.ref }}_-_cd_-_
1213 dist_branch_prefix : ${{ github.ref }}_-_dist_-_
@@ -15,18 +16,20 @@ jobs:
1516 runs-on : ubuntu-latest
1617 outputs :
1718 # ::set-output 命令将被弃用,而 env 又不能直接在下面非 steps 中使用,而 steps 又不支持 uses 使用 action yml 文件……因此这里转发使用 env
19+ repository : ${{ env.repository }}
1820 main_branch : ${{ env.main_branch }}
1921 cd_branch_prefix : ${{ env.cd_branch_prefix }}
2022 dist_branch_prefix : ${{ env.dist_branch_prefix }}
2123 steps :
2224 - id : nothing-step
2325 run : |
24- echo "这一步是必要的,去掉会报错"
26+ echo "这一步是必要的,去掉会报错。env.repository=${{ env.repository }} "
2527 build :
2628 needs : setup
2729 uses : ./.github/workflows/validation.yml
2830 secrets : inherit
2931 with :
32+ repository : ${{ needs.setup.outputs.repository }}
3033 main_branch : ${{ needs.setup.outputs.main_branch }}
3134 cd_path : " ${{ inputs.name }}/ci"
3235 cd_branch : " ${{ needs.setup.outputs.cd_branch_prefix }}${{ inputs.name }}"
Original file line number Diff line number Diff line change @@ -6,6 +6,9 @@ name: Validation
66on :
77 workflow_call :
88 inputs :
9+ repository : # 上游仓库
10+ required : true
11+ type : string
912 main_branch : # 上游主分支
1013 required : true
1114 type : string
2932 - name : Checkout repository
3033 uses : actions/checkout@v4
3134 with :
35+ repository : ${{ inputs.repository }}
3236 fetch-depth : 0 # 确保可以获取所有历史记录,以便合并
3337 token : ${{ secrets.TOEKN_FOREVER_FULL_WRITE }} # 使用具有完全写入权限的 TOKEN(必须包含 workflows )
3438
@@ -145,6 +149,7 @@ jobs:
145149 id : push_dist_branch
146150 uses : ad-m/github-push-action@master
147151 with :
152+ repository : ${{ inputs.repository }}
148153 branch : ${{ inputs.dist_branch }}
149154 force : true
150155 # force_with_lease: true # 仅在远程分支自上次检出以来没有其他提交的情况下成功
@@ -156,6 +161,7 @@ jobs:
156161 id : push_cd_branch
157162 uses : ad-m/github-push-action@master
158163 with :
164+ repository : ${{ inputs.repository }}
159165 branch : ${{ inputs.cd_branch }}
160166 force : true
161167 # force_with_lease: true # 仅在远程分支自上次检出以来没有其他提交的情况下成功
You can’t perform that action at this time.
0 commit comments