在我的 GitHub Actions 工作流程中使用 https://github.com/dawidd6/action-download-artifact,我无法将下载的工件显示在我的目标存储库中。
我也遇到了类似的问题 https://github.com/actions/download-artifact。我正在使用 GitHub Enterprise,并且知道 download-artifact v4 尚不支持企业版,但 v4 支持从另一个存储库下载。
运行结果看起来很成功,并且使项目膨胀:
Run dawidd6/action-download-artifact@v6
with:
name: dist_assets
github_token: ***
repo: my-org/control-repo
run_id: 11690180261
workflow_search: false
workflow_conclusion: success
name_is_regexp: false
path: ./
allow_forks: false
check_artifacts: false
search_artifacts: false
skip_unpack: false
if_no_artifact_found: fail
==> Repository: my-org/control-repo
==> Artifact name: dist_assets
==> Local path: ./
==> Workflow name: 125400437
==> Workflow conclusion: success
==> Allow forks: false
==> Artifact: 2148824413
==> Downloading: dist_assets.zip (3.45 MB)
==> Extracting: dist_assets.zip
这是目标存储库的工作流程 YAML 文件:
on:
# Listen to a repository dispatch event by the name of `dispatch-event`
repository_dispatch:
types: [dispatch-event]
workflow_dispatch:
repository_dispatch:
jobs:
get_assets_and_deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]
with:
ref: ${{ github.event.client_payload.ref }}
- run: |
echo ${{ github.event.client_payload.sha }} && echo ${{ github.event.client_payload.run_id }}
- name: Get assets
uses: dawidd6/action-download-artifact@v6
with:
name: dist_assets
github_token: ${{ secrets.THEME_WORKFLOW_TOKEN }} # token with actions:read permissions on target repo
repo: my-org/control-repo
run_id: ${{ github.event.client_payload.run_id }}
这是控制存储库的 YAML 文件:
- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
name: dist_assets
path: web/app/themes/custom/dist/
- name: Repository Dispatch
uses: peter-evans/repository-dispatch@v3
with:
token: ${{ secrets.THEME_WORKFLOW_TOKEN }}
repository: my-org/target-repo
event-type: dispatch-event
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "run_id": "${{ github.run_id }}"}'
除了解压缩的项目未出现在目标存储库中之外,一切似乎都正常。我错过了什么吗?该工件可以从控制存储库手动下载,并显示 zip 文件是正确的。
origin 代表默认的远程存储库,通常是您从中克隆的存储库,而“上游”是指您可能想要跟踪或贡献更改的其他远程存储库