我在存储库a中有一个action.yml文件和一个Dockerfile,如下所示:
存储库A
action.yml
[...]
runs:
using: 'docker'
image: 'Dockerfile'
[...]
Dockerfile
FROM hello-world
# do something
现在在存储库B中,我使用操作和Dockerfile:
存储库B
.github/workflows/hello.yml
name: hello
on:
push:
branches:
- master
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: username/repoa@master
我在存储库A中使用Dockerfile的目的是:
- GitHub操作日志中没有与存储库B中的操作无关的准备步骤
- 因此它只在更新username/repoa时构建,而不是在更新username/repob时构建,因为Dockerfile没有更改
然而,在实践中,每次我提交到username/report并将GitHub操作日志弄得一团糟时,GitHub都会很高兴地重建Dockerfile。
我如何告诉GitHub只在存储库A更新时构建Dockerfile,并将其排除在操作日志之外?
Github工作流创建一台新机器来运行作业,这意味着当Github Actions构建映像时,您需要将此映像存储在注册表或其他文件中,并使用此存储的映像创建另一个step
。
您需要改进action.yml
来构建和存储映像,并创建另一个action2.yml
来说明如何处理容器。