During the gitlab pipeline (triggered after each commit on my branch), I want to know which files are concerned by the commit in order to apply specific bash script regarding each file.
I'm currently using the following code in my gitlabci.yaml
file:
- export DIFF=$(git show --stat HEAD)
- ./myBashScript.sh
Then I'm using $DIFF
in my bash script.
But is there a better approach? (I'm using a local gitlab 10.8)
答案 0 :(得分:0)
您已经可以使用existing CI variables来执行以下操作来检索已更改文件的列表:
git diff --name-only $CI_COMMIT_BEFORE_SHA $CI_COMMIT_SHA
CI_BUILD_BEFORE_SHA和CI_BUILD_REF(如果您是running on Gitlab 8.x