File tree 2 files changed +10
-1
lines changed 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change 7
7
required : true
8
8
type : string
9
9
env :
10
+ repository : ${{ github.repository }} # 可以指定独立的仓库
10
11
main_branch : ${{ github.ref }}
11
12
cd_branch_prefix : ${{ github.ref }}_-_cd_-_
12
13
dist_branch_prefix : ${{ github.ref }}_-_dist_-_
@@ -15,18 +16,20 @@ jobs:
15
16
runs-on : ubuntu-latest
16
17
outputs :
17
18
# ::set-output 命令将被弃用,而 env 又不能直接在下面非 steps 中使用,而 steps 又不支持 uses 使用 action yml 文件……因此这里转发使用 env
19
+ repository : ${{ env.repository }}
18
20
main_branch : ${{ env.main_branch }}
19
21
cd_branch_prefix : ${{ env.cd_branch_prefix }}
20
22
dist_branch_prefix : ${{ env.dist_branch_prefix }}
21
23
steps :
22
24
- id : nothing-step
23
25
run : |
24
- echo "这一步是必要的,去掉会报错"
26
+ echo "这一步是必要的,去掉会报错。env.repository=${{ env.repository }} "
25
27
build :
26
28
needs : setup
27
29
uses : ./.github/workflows/validation.yml
28
30
secrets : inherit
29
31
with :
32
+ repository : ${{ needs.setup.outputs.repository }}
30
33
main_branch : ${{ needs.setup.outputs.main_branch }}
31
34
cd_path : " ${{ inputs.name }}/ci"
32
35
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
6
6
on :
7
7
workflow_call :
8
8
inputs :
9
+ repository : # 上游仓库
10
+ required : true
11
+ type : string
9
12
main_branch : # 上游主分支
10
13
required : true
11
14
type : string
29
32
- name : Checkout repository
30
33
uses : actions/checkout@v4
31
34
with :
35
+ repository : ${{ inputs.repository }}
32
36
fetch-depth : 0 # 确保可以获取所有历史记录,以便合并
33
37
token : ${{ secrets.TOEKN_FOREVER_FULL_WRITE }} # 使用具有完全写入权限的 TOKEN(必须包含 workflows )
34
38
@@ -145,6 +149,7 @@ jobs:
145
149
id : push_dist_branch
146
150
uses : ad-m/github-push-action@master
147
151
with :
152
+ repository : ${{ inputs.repository }}
148
153
branch : ${{ inputs.dist_branch }}
149
154
force : true
150
155
# force_with_lease: true # 仅在远程分支自上次检出以来没有其他提交的情况下成功
@@ -156,6 +161,7 @@ jobs:
156
161
id : push_cd_branch
157
162
uses : ad-m/github-push-action@master
158
163
with :
164
+ repository : ${{ inputs.repository }}
159
165
branch : ${{ inputs.cd_branch }}
160
166
force : true
161
167
# force_with_lease: true # 仅在远程分支自上次检出以来没有其他提交的情况下成功
You can’t perform that action at this time.
0 commit comments