github - 访问 Github 工作流的工件
问题描述
我是 Github 工作流程的新手,在下载我的工件表单完成的工作流程时有些吃力。
我的工作流程运行良好:构建项目并上传工件
- name: 4. Store artifact in GitHub
uses: actions/upload-artifact@v2
with:
name: my-artifact
path: target/my-project.jar
retention-days: 1
if-no-files-found: error
上传工件后,我在我的服务器上触发端点,假设下载和部署我的工件。
- name: 5. Run deploy on server
uses: fjogeleit/http-request-action@master
with:
url: 'my-endpoint'
method: 'POST'
contentType: application/x-www-form-urlencoded
data: '{"run-id": "${{github.run_id}}", "repo": "${{github.repository}}", "secret": "${{ secrets.GITHUB_TOKEN }}"}'
preventFailureOnNoResponse: 'true'
在工作流完成并且我的服务器收到开始部署过程的请求后,该工件可用。
我现在面临的挑战是授权。最初我使用我的“个人访问令牌”来下载文件(并且它有效),但这看起来是错误的(使用我的私人令牌)。
我试图找出是否有一个临时令牌(或类似的东西)可以让我从外部服务器下载我的工件。我尝试了 secrets.GITHUB_TOKEN 但这对我不起作用(或者我用错了)。
以下是我检查工件的方法: https ://api.github.com/repos/${owner}/${repo}/actions/runs/${id}/artifacts
您能否指出我如何在不提供私人令牌的情况下从工作流程中获取我的工件?
谢谢。
解决方案
推荐阅读
- git - 使用 TFVC 时强制执行类似 Git 的行为
- laravel - 如何对普通用户隐藏 dx datagrid 中的编辑选项
- angular - 在 AWS 的 S3 中托管的 Angular 应用程序中使用 Post 方法
- javascript - 正则表达式找到某些字符,但如果在某些模式之间则找不到
- c# - 通过公共变量分配的事件触发器未触发
- python - 在python中将文本转换为时间格式
- c# - Asp.Net c# 窗口应用程序
- javascript - 我应该检查哪种道具类型需要来源?
- android - 在 ConstraintLayout 中拖放
- php - 是否可以在 Rosell-dk 包中转换没有 shell_exec() 或 exec() 的 webp 图像?