Preserve SKILL.md formatting during version bumps - #7
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 429ff6e58b
ℹ️ 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".
| re.DOTALL, | ||
| ) | ||
| VERSION = re.compile( | ||
| r"^version[ \t]*:[ \t]*" |
There was a problem hiding this comment.
Handle valid YAML key syntax when matching versions
When a valid SKILL.md indents its root mapping ( version: 0.5.0) or quotes the key ("version": 0.5.0), this anchored literal finds zero matches and set_version raises. The previous python-frontmatter implementation parsed both forms as the version field, so the Bump version step in .github/workflows/bump-skill.yml can now abort for previously supported frontmatter; parse the key structurally or support these valid YAML forms.
Useful? React with 👍 / 👎.
|
|
||
|
|
||
| FRONTMATTER = re.compile( | ||
| r"\A---\r?\n(?P<body>.*?)(?=\r?\n---(?:\r?\n|\Z))", |
There was a problem hiding this comment.
Accept whitespace on frontmatter delimiters
When either delimiter has trailing whitespace, such as --- \n, this expression does not recognize the frontmatter even though that is valid YAML marker syntax and was accepted by the previous python-frontmatter boundary matcher. The release workflow will therefore reject an otherwise valid SKILL.md instead of updating it, which also conflicts with the stated goal of preserving existing formatting.
Useful? React with 👍 / 👎.
|
|
||
| def set_version(text: str, version: str) -> str: | ||
| if not frontmatter.checks(text): | ||
| frontmatter = FRONTMATTER.match(text) |
There was a problem hiding this comment.
Retain YAML validation before rewriting frontmatter
When the frontmatter contains malformed YAML outside the version line—for example an unterminated flow sequence in description—FRONTMATTER.match and VERSION.finditer still succeed, so the script commits and attempts to release an invalid SKILL.md. The former frontmatter.loads call rejected such input before modifying it; validate the captured document as YAML while still performing the byte-preserving replacement.
Useful? React with 👍 / 👎.
Summary
Tests
python .github/scripts/tests/test_bump_version.py -vpython .github/scripts/tests/test_validate_rollback_version.py -v