-
Notifications
You must be signed in to change notification settings - Fork 430
Query GitHub API when determining release version #4091
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| def release_tag_from_event() -> str: | ||
| event_path = os.environ.get("GITHUB_EVENT_PATH") | ||
| if event_path: | ||
| event_file = Path(event_path) | ||
| if event_file.is_file(): | ||
| try: | ||
| data = json.loads(event_file.read_text()) | ||
| except json.JSONDecodeError: | ||
| data = {} | ||
| release = data.get("release") or {} | ||
| tag = release.get("tag_name") or release.get("target_commitish") or "" | ||
| if tag: | ||
| return _sanitize_tag(tag) | ||
| for key in ("GITHUB_REF_NAME", "GITHUB_REF"): | ||
| value = os.environ.get(key) | ||
| if value: | ||
| sanitized = _sanitize_tag(value) | ||
| if sanitized: | ||
| return sanitized |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore non-version refs when deriving release tag
The new release version helper takes the first non-empty value returned by release_tag_from_event(). That function now returns any GITHUB_REF_NAME/GITHUB_REF even if it is just a branch name such as main. In pull-request and workflow_dispatch runs this means the script prints main (or the current branch) and exits before calling latest_release_from_api(), so the documentation workflow publishes attributes like {cn1-plugin-release-version} as main instead of a numeric release tag. The generated Maven commands and version text become invalid on every non‑release run. release_tag_from_event() should only accept refs that look like a version tag (e.g. start with v or match \d+(\.\d+)*) and otherwise fall through to the API/git fallbacks.
Useful? React with 👍 / 👎.
|
Developer Guide build artifacts are available for download from this workflow run:
Developer Guide quality checks: |
Summary
Testing
https://chatgpt.com/codex/tasks/task_e_6903a29e24f88331bad24d9934844874