0

Is there a way for Github or Jenkins to detect when a file has been added to, modified or deleted from a Github repo so that it can trigger scripts (e.g. trigger an automatic dry-run of the proposed change in NSO for someone to review)?

1 Answers1

0

Jenkins SCM git or svn based jobs can be started either by polling for changes or if triggered by a hook. It will not be capable of determining if new files have been added just changes are detected.

In Jenkins you can implement a script which checks for newly added files each time a change is detected or triggered by a hook, and skip further execution if no new files have been added.

In Git you could implement the same logic in a hook, if such scripted hooks are supported by github, and trigger a Jenkins build only if new files have been added.

Some links which may help

git: list new files only

https://git-scm.com/docs/git-ls-files

https://githooks.com

https://jenkins.io/solutions/github/

Community
  • 1
  • 1
Thomas Herzog
  • 506
  • 2
  • 6