Skip to content

Fix single-line GitHub API response parsing#8013

Merged
MichaIng merged 9 commits intodevfrom
dev-StS_UptimeKumaInstallation
Mar 14, 2026
Merged

Fix single-line GitHub API response parsing#8013
MichaIng merged 9 commits intodevfrom
dev-StS_UptimeKumaInstallation

Conversation

@StephanStS
Copy link
Collaborator

@StephanStS StephanStS commented Mar 12, 2026

ChatGPT also gave this optional solution:

echo '...your JSON string...' | mawk '
  match($0, /"tag_name"[[:space:]]*:[[:space:]]*"[^"]*"/) {
    val = substr($0, RSTART, RLENGTH)
    # Remove all in front of the value:
    gsub(/.*"tag_name"[[:space:]]*:[[:space:]]*"/, "", val)
    # Remove trailing ":
    gsub(/".*/, "", val)
    print val
  }
'

Did not test this, maybe halluzination. :-)

@StephanStS StephanStS added this to the v10.2 milestone Mar 12, 2026
@StephanStS StephanStS requested review from MichaIng and Copilot March 12, 2026 11:10
@StephanStS StephanStS self-assigned this Mar 12, 2026
@Joulinar
Copy link
Collaborator

Joulinar commented Mar 12, 2026

@StephanStS This issue is not dedicated to Kuma. It's a general issue with fetching correct version string via GitHub API #8009

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes Uptime Kuma version detection in dietpi-software so the installer pulls the actual latest GitHub release instead of consistently falling back to an older hardcoded version.

Changes:

  • Update GitHub API tag_name parsing for Uptime Kuma latest release detection.
  • Add a CHANGELOG entry documenting the fix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
dietpi/dietpi-software Adjusts Uptime Kuma version detection logic when downloading the release tarball.
CHANGELOG.txt Documents the Uptime Kuma installer version-detection fix.

You can also share your feedback on Copilot code review. Take the survey.

@Joulinar
Copy link
Collaborator

Theoretically there is another option like

curl -sSfL https://api.github.com/repos/louislam/uptime-kuma/releases/latest | sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p'

@StephanStS
Copy link
Collaborator Author

StephanStS commented Mar 12, 2026

Theoretically there is another option like

curl -sSfL https://api.github.com/repos/louislam/uptime-kuma/releases/latest | sed -n 's/.*"tag_name": *"\([^"]*\)".*/\1/p'

Works.
Might be the better solution like copilot mentioned above with grep.

StephanStS and others added 2 commits March 12, 2026 13:23
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@Joulinar
Copy link
Collaborator

@StephanStS Fallback version will be automatically updated by GitHub Actions on an own PR #7976

@StephanStS
Copy link
Collaborator Author

@StephanStS Fallback version will be automatically updated by GitHub Actions on an own PR #7976

Does this require an own change at a different place / within any bot (regarding the determination of newer versions)?

@Joulinar
Copy link
Collaborator

@MichaIng create a bot who is checking these fallback URL automatically. https://github.com/MichaIng/DietPi/actions/workflows/update_urls.yml
It's running at 6am and will do the magic. All updated URL are stored in an own PR und will be merged once we move to Beta/Master.

@MichaIng
Copy link
Owner

The sed seems quite a nice simple solution to support both: single-line and multi-line API outputs. But yes, makes sense to apply it globally. And I still want to find out whether these inconsistent API outputs are intended or not.

@StephanStS
Copy link
Collaborator Author

@MichaIng create a bot who is checking these fallback URL automatically. https://github.com/MichaIng/DietPi/actions/workflows/update_urls.yml It's running at 6am and will do the magic. All updated URL are stored in an own PR und will be merged once we move to Beta/Master.

Then, this task was not successful, because there is a newer Uptime Kuma since last week (https://github.com/louislam/uptime-kuma/releases).
Maybe the bot also uses the wrong mawk filtering?

@Joulinar
Copy link
Collaborator

Then, this task was not successful, because there is a newer Uptime Kuma since last week

I guess a misunderstanding, the PR is open and has not been merged into DEV branch yet. It will be done short before BETA testing. The GitHub agent already fetched the new version. see the linked PR above

@StephanStS
Copy link
Collaborator Author

Then, this task was not successful, because there is a newer Uptime Kuma since last week

I guess a misunderstanding, the PR is open and has not been merged into DEV branch yet. It will be done short before BETA testing. The GitHub agent already fetched the new version. see the linked PR above

Aaah, the last entry. I missed that, my fault. :-)

@StephanStS StephanStS marked this pull request as ready for review March 12, 2026 14:11
@StephanStS StephanStS requested a review from Joulinar March 12, 2026 14:11
@MichaIng MichaIng linked an issue Mar 12, 2026 that may be closed by this pull request
1 task
@MichaIng MichaIng changed the title Uptime Kukma: Installation always used outdated version Uptime Kuma: Installation always used outdated version Mar 14, 2026
@MichaIng
Copy link
Owner

Great, this works as well on https://api.github.com/repos/louislam/uptime-kuma/releases instead of https://api.github.com/repos/louislam/uptime-kuma/releases/latest, and prints each match in every line on an individual output line, e.g. for sorting to find the latest (pre-)release asset.

@copilot
Please apply this change throughout the script as well as in https://github.com/MichaIng/DietPi/blob/dev/.github/workflows/update_urls.bash.

In update_urls.bash, while on it, please additionally change the following:

  • For every software ID which has aARCH defined, move the URL to a new aURL array, call curl only once before the aARCH loop, cache the response in a response variable, and replace the curl call in aCHECK with echo "$response" accordingly. Add the GitHub token header as well for those new curl -sSf "${aURL[i]}" calls if the URL starts with https://api.github.com/.

Copy link
Contributor

Copilot AI commented Mar 14, 2026

@MichaIng I've opened a new pull request, #8016, to work on those changes. Once the pull request is ready, I'll request review from you.

StephanStS and others added 2 commits March 14, 2026 22:37
…s for arch-specific checks (#8016)

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: MichaIng <micha@dietpi.com>
@MichaIng MichaIng changed the title Uptime Kuma: Installation always used outdated version Fix single-line GitHub API response parsing Mar 14, 2026
@MichaIng MichaIng merged commit b56e32a into dev Mar 14, 2026
2 checks passed
@MichaIng MichaIng deleted the dev-StS_UptimeKumaInstallation branch March 14, 2026 22:51
MichaIng added a commit that referenced this pull request Mar 14, 2026
Co-Authored-By: Copilot <175728472+Copilot@users.noreply.github.com>
Co-Authored-By: MichaIng <micha@dietpi.com>
Co-Authored-By: Copilot <198982749+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GitHub API parsing sometimes fails due to minified JSON response

5 participants