github - Github Actions:如何为多个作业创建多行环境变量
问题描述
我想将几行添加到代码文件中。这在各种工作中。所以我创建了一个创建文本文件并上传的作业。
create_file:
runs-on: ubuntu-latest
steps:
- shell: bash
run: |
cat << EOF > data.txt
A = "..."
B = "..."
C = "..."
...
EOF
- name: Create data file
uses: actions/upload-artifact@1
with:
name: configuration
path: data.txt
在下一项工作中,我上传文件并希望将此行附加到代码文件中。
test_file:
runs-on: ubuntu-latest
needs: [create_file]
steps:
- name: Download file
uses: actions/download-artifact@v1
with:
name: configuration
path: configuration/data.txt
- shell: bash
run: |
cat configuration/data.txt >> main.py
python main.py
我的问题是第二个作业太快了,在data.txt
文件上传之前搜索文件,以及如何处理附加内容。每行的命令echo "..." >> main.py
会很烦人。
更新:
现在我得到data.txt
以下错误消息的工作:
Download action repository 'actions/upload-artifact@1'
##[warning]Failed to download action 'https://api.github.com/repos/actions/upload-artifact/tarball/1'. Error Response status code does not indicate success: 404 (Not Found).
...
##[error]Response status code does not indicate success: 404 (Not Found).
解决方案
这个错误非常愚蠢。该行actions/upload-artifact@1
应该是actions/upload-artifact@v1
.
推荐阅读
- assembly - DosBox如何修复字符属性?
- vue.js - 使用计算属性绑定基于 Vuetify 的 Viewport 断点的样式
- python - 每次使用 Python 运行 cmd ''ipconfig/flushdns'' 命令?
- spring-boot - H2 数据库未找到错误:90146。启动时未创建 H2 数据库
- java - 如何使用对象的原始类转换引用?
- c++ - 有什么办法可以让 Rcpp 停止定义 NDEBUG?
- python - 使用 ssl 证书问题在 mac 上升级 pip
- php - WooCommerce 中特定产品和特定客户的折扣
- c# - 请求时未加载下一个场景
- php - 如何从多维数组中获取特定值?