Primitive validation script doesn't correctly detect changes in forks
The validation script is supposed to only validate files that have been changed in the branch, when running CI for a branch (ex: in a fork). It does this by fetching the upstream (this repo) then comparing upstream/master with the HEAD.
There are two problems:
- If there has been changes in the upstream, this can cause false-positive, and things that haven't been changed in the branch will be validated. This can cause buggy primitives that have been removed upstream to fail unrelated builds.
- The change detection and validation code doesn't filter some special non-primitive files, for example README.md (issue reported by @rszeto on slack for this CI job)
- Use a
...diff instead of
.., to only consider changes that happened in the local branch, not the upstream master: !188 (closed)
- Change the
validate_file()function to ignore changes to all top-level files, not just
.gitattributes(for example changing condition to
if '/' not in os.path.relpath(file_path)). This might not be necessary if merge requests are only ever meant to change .gitattributes and primitive annotations. Changes to README through merge requests would fail to build.