This commit is contained in:
Luna 2023-08-20 16:53:16 -03:00
parent 52fbc871b2
commit da5a86620e
3 changed files with 20 additions and 9 deletions

View file

@ -29,6 +29,7 @@ class GitFetch(FactBase):
class GitRevListComparison(FactBase):
def command(self, repo: str, branch: str):
assert branch
return f"git -C {repo} rev-list HEAD..origin/{branch} | wc -l"
def process(self, output):
@ -122,7 +123,7 @@ def repo(
# always fetch upstream branches (that way we can compare if the latest
# commit has changed, and then we don't need to execute anything!)
host.get_fact(GitFetch, repo=dest)
stdout = host.get_fact(GitRevListComparison, repo=dest, branch=branch)
stdout = host.get_fact(GitRevListComparison, repo=dest, branch=current_branch)
repository_has_updates = stdout[0] != "0"
# since we immediately always fetch, we will always be modifying the