codeant-ai-for-open-source[bot] commented on code in PR #44895:
URL: https://github.com/apache/superset/pull/44895#discussion_r4167235616
##########
scripts/change_detector.py:
##########
@@ -217,43 +254,10 @@ def main(event_type: str, sha: str, repo: str) -> None:
files, patterns_compiled
)
- # Output results
- output_path = os.getenv("GITHUB_OUTPUT") or "/tmp/GITHUB_OUTPUT.txt" #
noqa: S108
- with open(output_path, "a") as f:
- for check, changed in changes_detected.items():
- # NOTE: as noted above, we assume that if 100 files are touched,
we should
- # trigger all checks. This is a workaround for the GitHub API
limit of 100
- # files. Using >= 99 because off-by-one errors are not uncommon
- if changed or (files is not None and len(files) >= 99):
- print(f"{check}=true", file=f)
- print(f"Triggering group: {check}")
-
-
-def get_git_sha() -> str:
- return os.getenv("GITHUB_SHA") or subprocess.check_output( # noqa: S603
- ["git", "rev-parse", "HEAD"] # noqa: S603, S607
- ).strip().decode("utf-8")
-
-
-if __name__ == "__main__":
- parser = argparse.ArgumentParser(
- description="Detect file changes based on event context"
- )
- parser.add_argument(
- "--event-type",
- default=os.getenv("GITHUB_EVENT_NAME") or "push",
- help="The type of event that triggered the workflow",
- )
- parser.add_argument(
- "--sha",
- default=get_git_sha(),
- help="The commit SHA for push events or PR head SHA",
- )
- parser.add_argument(
- "--repo",
- default=os.getenv("GITHUB_REPOSITORY") or "apache/superset",
- help="GitHub repository in the format owner/repo",
- )
- args = parser.parse_args()
-
- main(args.event_type, args.sha, args.repo)
+ # The 100-file API cap below treats a push/PR touching that many files as
+ # "everything changed" for the PATTERNS groups; language detection
+ # honors the same assumption so a consumer combining both outputs never
+ # sees a language silently excluded by the cap.
+ languages = (
+ sorted(set(LANGUAGE_EXTENSIONS.values()))
+ if files is not None and len(files)
Review Comment:
✅ **CodeAnt verified this suggestion was addressed in subsequent commits and
marked this thread resolved** as of `5ee996b`.
The computed `languages` list is now written to the `GITHUB_OUTPUT` file as
a JSON value with `print(f"languages={json.dumps(languages)}", file=f)`,
exposing it to the composite action.
<sub>If that's not right, unresolve this thread and CodeAnt will leave it
open.</sub>
<!-- codeant-auto-resolve-reply -->
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]