我想将服务器行添加到代码文件中。而这在各种工作中。因此,我创建了一个作业,该作业创建了一个文本文件并将其上传。
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).
答案 0 :(得分:0)
错误非常愚蠢。第actions/upload-artifact@1
行应为actions/upload-artifact@v1
。