【发布时间】:2020-05-02 14:18:26
【问题描述】:
我想在代码文件中添加几行。这在各种工作中。所以我创建了一个创建文本文件并上传的作业。
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).
【问题讨论】:
-
那么希望两个作业并行执行,但第二个在第一个之后完成?否则,您可以将
needs create_file添加到test_file作业。见:help.github.com/en/actions/… -
你解决了吗?
-
@МихаилПавлов 遗憾的是没有。
-
@ikreb 我有一个。使用
tr的壳管。echo ${{secrets.DATA}} | tr ' ' '\n'
标签: github continuous-integration yaml github-actions