Feat(workflow): add step to fetch latest stable ABP version and updat…#24818
Feat(workflow): add step to fetch latest stable ABP version and updat…#24818m-aliozkaya merged 3 commits intodevfrom
Conversation
…e version mapping logic
There was a problem hiding this comment.
Pull request overview
This PR adds functionality to automatically fetch the latest stable ABP version from the GitHub API and use it when updating the Studio documentation version mapping file. Previously, the ABP version was hardcoded as "dev".
Changes:
- Added a new step to fetch the latest stable ABP version from GitHub releases API
- Refactored the version-mapping.md update step to use environment variables instead of inline shell variable substitution
- Improved Python script formatting with consistent indentation and extracted a
parse_rangehelper function
|
|
||
| if not handled: | ||
| new_rows.insert(0, f"| {studio} | {abp} |\n") | ||
| new_rows.insert(0, f"| {studio} | {abp} |\\n") |
There was a problem hiding this comment.
The escaped newline \\n in the f-string will result in a literal backslash-n being written to the file instead of an actual newline character. Since the file is being written using writelines(), which doesn't add newlines automatically, you should use \n (single backslash) or ensure each line already ends with a newline character. The existing rows in the file likely already have newlines from readlines(), but these new lines need proper newlines too.
| -H "Accept: application/vnd.github+json" \ | ||
| https://api.github.com/repos/abpframework/abp/releases/latest) | ||
|
|
||
| ABP_VERSION=$(echo "$RESPONSE" | jq -r '.tag_name') |
There was a problem hiding this comment.
The API response is being parsed with jq -r '.tag_name', which extracts the tag name from the GitHub release. However, GitHub release tags often include a 'v' prefix (e.g., 'v8.0.0'). Depending on how this version is used in the version-mapping.md file, you may need to strip the 'v' prefix to ensure consistency. Consider using ABP_VERSION=$(echo "$RESPONSE" | jq -r '.tag_name' | sed 's/^v//') if the version should not include the prefix.
| ABP_VERSION=$(echo "$RESPONSE" | jq -r '.tag_name') | |
| ABP_VERSION=$(echo "$RESPONSE" | jq -r '.tag_name' | sed 's/^v//') |
| studio_range, abp_version = m.groups() | ||
|
|
||
| studio_range, abp_version = m.groups() | ||
| if abp_version != abp: |
There was a problem hiding this comment.
The ABP version is being compared as a string (if abp_version != abp), which is appropriate if both are strings. However, if the version format varies (e.g., 'v8.0.0' vs '8.0.0'), this comparison will fail. Ensure that the version format is consistent, or normalize both versions before comparison. This is related to the potential 'v' prefix issue in the API response parsing.
| python3 <<EOF | ||
| import os | ||
| import re | ||
| from packaging.version import Version |
There was a problem hiding this comment.
The packaging module is not installed in the workflow. Before using from packaging.version import Version, you need to add a step to install the package using pip install packaging. Without this, the Python script will fail with an ImportError at runtime.
| new_rows.append(row) # already covered | ||
| handled = True | ||
| new_rows.append(row) | ||
| elif studio == end.next_patch(): |
There was a problem hiding this comment.
The next_patch() method does not exist in the packaging.version.Version class. This will cause an AttributeError when the condition is evaluated. You need to implement a custom method to calculate the next patch version, such as incrementing the patch number manually or using a different versioning library that supports this operation.
| handled = True | ||
| new_rows.append(f"| {v} - {studio} | {abp} |\n") | ||
| handled = True | ||
| new_rows.append(f"| {start} - {studio} | {abp} |\\n") |
There was a problem hiding this comment.
The escaped newline \\n in the f-string will result in a literal backslash-n being written to the file instead of an actual newline character. Since the file is being written using writelines(), which doesn't add newlines automatically, you should use \n (single backslash) or ensure each line already ends with a newline character. The existing rows in the file likely already have newlines from readlines(), but these new lines need proper newlines too.
|
@copilot open a new pull request to apply changes based on the comments in this thread |
[WIP] Add step to fetch latest stable ABP version
|
|
No description provided.