Github操作在不同的Worflow运行之间共享数据

时间:2020-10-30 14:51:38

标签: github-actions

我如何共享数据,例如一些ID,以便在稍后的某个时间运行另一种worklow运行?

我尝试使用工件,但它们似乎仅在作业之间运行的相同工作流程中起作用

1 个答案:

答案 0 :(得分:0)

一项正式行动actions/download-artifact不支持在管道之间共享工件,但是您可以使用此dawidd6/action-download-artifact@v2

- name: Download artifact
  uses: dawidd6/action-download-artifact@v2
  with:
    # Optional, GitHub token
    github_token: ${{secrets.GITHUB_TOKEN}}
    # Required, workflow file name or ID
    workflow: workflow_name.yml
    # Optional, will get head commit SHA
    pr: ${{github.event.pull_request.number}}
    # Optional, no need to specify if PR is
    commit: ${{github.event.pull_request.head.sha}}
    # Optional, will use the branch
    branch: master
    # Optional, will use specified workflow run
    run_id: 1122334455
    # Optional, uploaded artifact name,
    # will download all artifacts if not specified
    # and extract them in respective subdirectories
    # https://github.com/actions/download-artifact#download-all-artifacts
    name: artifact_name
    # Optional, directory where to extract artifact
    path: extract_here
    # Optional, defaults to current repo
    repo: ${{github.repository}}