-
Notifications
You must be signed in to change notification settings - Fork 11
build: fix artifact retreival in plugin promotion workflow #1458
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
WalkthroughA GitHub Actions workflow was updated to use double quotes for input descriptions, expand job permissions to include Changes
Possibly related PRs
Suggested reviewers
Poem
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/workflows/push-staging-pr-on-close.yml (1)
40-51: Trim the extra dependency onjqby usinggh api --jq
jqis available on the runner today, but it’s not guaranteed forever.
gh apialready supports server-side filtering via--jq, so we can drop the pipe and keep the step slimmer:- gh api repos/${{ github.repository }}/actions/artifacts --paginate | \ - jq -r '.artifacts[] | select(.workflow_run.head_branch == "pr/${{ steps.pr_number.outputs.pr_number }}") | " - \(.name) (run: \(.workflow_run.id))"' || echo "No artifacts found or error listing artifacts" + gh api repos/${{ github.repository }}/actions/artifacts \ + --paginate \ + --jq '.artifacts[] | select(.workflow_run.head_branch == "pr/${{ steps.pr_number.outputs.pr_number }}") | " - \(.name) (run: \(.workflow_run.id))"' \ + || echo "No artifacts found or error listing artifacts"Benefits: one less process, clearer intent, and slightly faster execution.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/push-staging-pr-on-close.yml(3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: elibosley
PR: unraid/api#1120
File: plugin/Dockerfile:1-3
Timestamp: 2025-02-05T14:25:37.316Z
Learning: The Dockerfile in the plugin directory is specifically for building artifacts during CI and is not used for production deployments. It creates a build environment with Node.js and necessary dependencies to generate plugin files.
Learnt from: elibosley
PR: unraid/api#1125
File: .github/workflows/main.yml:233-233
Timestamp: 2025-02-07T19:53:37.715Z
Learning: In the plugin build workflow, the TAG environment variable (previously PR) is used for display purposes in OS releases, with "PR" prefix indicating it's from a pull request.
Learnt from: elibosley
PR: unraid/api#1120
File: .github/workflows/main.yml:240-240
Timestamp: 2025-02-05T14:44:05.679Z
Learning: In GitHub Actions workflows, Docker commands will automatically fail the build if they return a non-zero exit code, making explicit error handling unnecessary.
Learnt from: pujitm
PR: unraid/api#1352
File: packages/unraid-api-plugin-generator/src/create-plugin.ts:91-112
Timestamp: 2025-04-21T18:27:36.482Z
Learning: For utility functions like file operations in api plugin generators, pujitm prefers minimal error handling rather than verbose try/catch blocks for each operation, as errors will propagate properly to higher level error handlers.
.github/workflows/push-staging-pr-on-close.yml (1)
Learnt from: elibosley
PR: unraid/api#1125
File: .github/workflows/main.yml:233-233
Timestamp: 2025-02-07T19:53:37.715Z
Learning: In the plugin build workflow, the TAG environment variable (previously PR) is used for display purposes in OS releases, with "PR" prefix indicating it's from a pull request.
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: Test API
- GitHub Check: Build Web App
- GitHub Check: Build API
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (1)
.github/workflows/push-staging-pr-on-close.yml (1)
9-17: Input descriptions: change to double quotes looks good
No functional impact; keeps YAML consistent with the other strings in the workflow.
709c74c to
fc00f1b
Compare
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.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/push-staging-pr-on-close.yml (2)
10-10: Keep quoting style consistent across workflowsSwitching to double-quotes is harmless, but other workflow files still mix single and double quotes for descriptions. Consider standardising on one style repo-wide to avoid noisy diffs.
Also applies to: 14-14
65-65: Trailing whitespace flagged by YAML-lintLine 65 has stray spaces; remove to keep the workflow YAML-lint-clean.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/push-staging-pr-on-close.yml(4 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: elibosley
PR: unraid/api#1120
File: plugin/Dockerfile:1-3
Timestamp: 2025-02-05T14:25:37.316Z
Learning: The Dockerfile in the plugin directory is specifically for building artifacts during CI and is not used for production deployments. It creates a build environment with Node.js and necessary dependencies to generate plugin files.
Learnt from: elibosley
PR: unraid/api#1125
File: .github/workflows/main.yml:233-233
Timestamp: 2025-02-07T19:53:37.715Z
Learning: In the plugin build workflow, the TAG environment variable (previously PR) is used for display purposes in OS releases, with "PR" prefix indicating it's from a pull request.
Learnt from: elibosley
PR: unraid/api#1120
File: plugin/scripts/build-plugin-and-txz.ts:177-200
Timestamp: 2025-02-05T14:43:04.715Z
Learning: In the plugin build system (plugin/scripts/build-plugin-and-txz.ts), updating all XML entities in a single loop is an acceptable pattern when all values need to be replaced, as it ensures consistency and maintainability. The PR entity is optional and handled separately in the validation.
Learnt from: elibosley
PR: unraid/api#1167
File: api/package.json:69-69
Timestamp: 2025-02-20T22:12:49.905Z
Learning: The repository has automated workflows that handle dependency compatibility checks, making manual verification redundant during dependency updates.
Learnt from: pujitm
PR: unraid/api#1352
File: packages/unraid-api-plugin-generator/src/create-plugin.ts:91-112
Timestamp: 2025-04-21T18:27:36.482Z
Learning: For utility functions like file operations in api plugin generators, pujitm prefers minimal error handling rather than verbose try/catch blocks for each operation, as errors will propagate properly to higher level error handlers.
.github/workflows/push-staging-pr-on-close.yml (4)
Learnt from: elibosley
PR: unraid/api#1125
File: .github/workflows/main.yml:233-233
Timestamp: 2025-02-07T19:53:37.715Z
Learning: In the plugin build workflow, the TAG environment variable (previously PR) is used for display purposes in OS releases, with "PR" prefix indicating it's from a pull request.
Learnt from: pujitm
PR: unraid/api#1415
File: plugin/plugins/dynamix.unraid.net.plg:234-236
Timestamp: 2025-06-11T14:14:30.348Z
Learning: For the Unraid Connect plugin, the script `/etc/rc.d/rc.unraid-api` is bundled with the plugin package itself, so its presence on the target system is guaranteed during installation.
Learnt from: elibosley
PR: unraid/api#1381
File: plugin/source/dynamix.unraid.net/usr/local/share/dynamix.unraid.net/install/scripts/verify_install.sh:19-24
Timestamp: 2025-05-08T19:28:54.365Z
Learning: The directory `/usr/local/emhttp/plugins/dynamix.my.servers` is a valid directory that exists as part of the Unraid API plugin installation and should be included in verification checks.
Learnt from: elibosley
PR: unraid/api#1120
File: plugin/scripts/build-plugin-and-txz.ts:177-200
Timestamp: 2025-02-05T14:43:04.715Z
Learning: In the plugin build system (plugin/scripts/build-plugin-and-txz.ts), updating all XML entities in a single loop is an acceptable pattern when all values need to be replaced, as it ensures consistency and maintainability. The PR entity is optional and handled separately in the validation.
🪛 YAMLlint (1.37.1)
.github/workflows/push-staging-pr-on-close.yml
[error] 65-65: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: Build API
- GitHub Check: Build Web App
- GitHub Check: Test API
- GitHub Check: Analyze (javascript-typescript)
- GitHub Check: Cloudflare Pages
🔇 Additional comments (2)
.github/workflows/push-staging-pr-on-close.yml (2)
25-25: 👍 Necessary permission added
actions: readis required for the artifact-download action to query the Actions API. Good catch.
49-50: Verify input support in the chosen action version
workflow_searchandsearch_artifactswere added in later releases ofdawidd6/action-download-artifact. The tagv11predates those inputs, so they will be silently ignored.
Either confirm that a newer tag (e.g.v2) is already aliased to the same commit that supports these inputs, or bump the action version explicitly.
| # Change the plugin url to point to staging | ||
| url="https://preview.dl.unraid.net/unraid-api/dynamix.unraid.net.plg" | ||
| sed -i -E "s#(<!ENTITY pluginURL \").*(\">)#\1${url}\2#g" "${plgfile}" || exit 1 | ||
| sed -i -E "s#(<!ENTITY plugin_url \").*?(\">)#\1${url}\2#g" "${plgfile}" || exit 1 |
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.
Sed pattern never matches – non-greedy .*? isn’t supported
GNU sed ERE doesn’t recognise the Perl-style lazy quantifier ? after *; the pattern will fail to match and plugin_url stays unchanged.
- sed -i -E "s#(<!ENTITY plugin_url \").*?(\">)#\1${url}\2#g" "${plgfile}" || exit 1
+ sed -i -E "s#(<!ENTITY plugin_url \")[^\"]*(\">)#\1${url}\2#g" "${plgfile}" || exit 1The character-class approach [^"]* reliably matches up to the closing quote without using PCRE.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| sed -i -E "s#(<!ENTITY plugin_url \").*?(\">)#\1${url}\2#g" "${plgfile}" || exit 1 | |
| sed -i -E "s#(<!ENTITY plugin_url \")[^\"]*(\">)#\1${url}\2#g" "${plgfile}" || exit 1 |
🤖 Prompt for AI Agents
In .github/workflows/push-staging-pr-on-close.yml at line 68, the sed command
uses a non-greedy quantifier `.*?` which GNU sed does not support, causing the
pattern to never match and leaving `plugin_url` unchanged. Replace `.*?` with a
character class pattern `[^"]*` to correctly match all characters up to the
closing quote, ensuring the substitution works as intended.
|
This plugin has been deployed to Cloudflare R2 and is available for testing. |
Tested via manual dispatch on #1456 via cli. results in:
Summary by CodeRabbit