-
Couldn't load subscription status.
- Fork 11
fix: pr plugin promotion workflow #1456
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
WalkthroughThe GitHub Actions workflow was updated to support manual triggering with parameters, dynamic PR number handling, and improved artifact processing. The checkout step was removed, artifact download logic was enhanced, and plugin file discovery was made dynamic. No changes were made to exported or public code entities. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant GitHub Actions Workflow
participant Artifact Store
User->>GitHub Actions Workflow: Trigger (PR close or manual dispatch)
GitHub Actions Workflow->>GitHub Actions Workflow: Set PR number (from event or input)
GitHub Actions Workflow->>Artifact Store: Download artifact (using PR number)
GitHub Actions Workflow->>GitHub Actions Workflow: Discover .plg file dynamically
GitHub Actions Workflow->>GitHub Actions Workflow: Update plugin version and URL
GitHub Actions Workflow->>Artifact Store: Upload updated plugin
Possibly related PRs
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: 1
🧹 Nitpick comments (4)
.github/workflows/push-staging-pr-on-close.yml (4)
7-17: Consider defaultingpr_mergedtofalseand double-check boolean input syntaxA manual dispatch that automatically pushes to staging unless the caller flips a switch can be surprising.
Switching the default tofalsebetter mirrors the real-world case where a PR is not yet merged.- pr_merged: + pr_merged: description: 'Simulate merged PR' required: true - type: boolean - default: true + type: boolean + default: false(Recent GitHub Actions releases accept
type: boolean, so the field itself is fine.)
31-38: Harden the PR-number helper scriptSmall shell tweaks improve safety and readability:
-ID: pr_number -run: | - if [ "${{ github.event_name }}" == "pull_request" ]; then - echo "pr_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT - else - echo "pr_number=${{ inputs.pr_number }}" >> $GITHUB_OUTPUT - fi +id: pr_number +run: | + set -eu + if [ "${{ github.event_name }}" = "pull_request" ]; then + PR_NO="${{ github.event.pull_request.number }}" + else + PR_NO="${{ inputs.pr_number }}" + fi + echo "pr_number=$PR_NO" >> "$GITHUB_OUTPUT"•
set -eufails fast on any error.
• Using a temporary variable avoids duplicating the echo line.
41-47: Explicitly passgithub_tokento the artifact-download step
dawidd6/action-download-artifactfalls back to the default token, but being explicit avoids surprises and makes audits easier—especially if the default permission set changes.-uses: dawidd6/action-download-artifact@v11 -with: +uses: dawidd6/action-download-artifact@v11 +with: name_is_regexp: true name: unraid-plugin-.* path: connect-files pr: ${{ steps.pr_number.outputs.pr_number }} workflow_conclusion: success + github_token: ${{ secrets.GITHUB_TOKEN }}
58-58: Remove trailing whitespaceYAML-lint flags this line. It doesn’t break the workflow but clutters diffs.
- +
📜 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#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#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: elibosley
PR: unraid/api#1120
File: plugin/package.json:1-8
Timestamp: 2025-02-05T14:43:25.062Z
Learning: The repository uses Renovate for automated dependency updates, making strict version pinning in package.json less critical as updates are handled automatically through PRs.
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.
🪛 YAMLlint (1.37.1)
.github/workflows/push-staging-pr-on-close.yml
[error] 58-58: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: Build Web App
- GitHub Check: Build API
- GitHub Check: Test API
- GitHub Check: Analyze (javascript-typescript)
| jobs: | ||
| push-staging: | ||
| if: github.event.pull_request.merged == true | ||
| if: (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || (github.event_name == 'workflow_dispatch' && inputs.pr_merged == true) |
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.
🛠️ Refactor suggestion
Guard against undefined inputs in non-dispatch events
inputs.pr_merged does not exist on pull_request events.
Although expressions usually coerce null to false, accessing a missing object can break unexpectedly.
Safer pattern:
-if: (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || (github.event_name == 'workflow_dispatch' && inputs.pr_merged == true)
+if: >
+ (github.event_name == 'pull_request' &&
+ github.event.pull_request.merged == true) ||
+ (github.event_name == 'workflow_dispatch' &&
+ github.event.inputs.pr_merged == 'true')This keeps each clause inside the event it belongs to and uses the documented github.event.inputs accessor.
📝 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.
| if: (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || (github.event_name == 'workflow_dispatch' && inputs.pr_merged == true) | |
| if: > | |
| (github.event_name == 'pull_request' && | |
| github.event.pull_request.merged == true) || | |
| (github.event_name == 'workflow_dispatch' && | |
| github.event.inputs.pr_merged == 'true') |
🤖 Prompt for AI Agents
In .github/workflows/push-staging-pr-on-close.yml at line 21, the condition
accesses inputs.pr_merged without guarding against undefined inputs in
non-dispatch events, which can cause errors. Refactor the condition to check
inputs.pr_merged only when the event is workflow_dispatch by using
github.event.inputs.pr_merged, and keep each clause scoped to its event type to
avoid accessing undefined properties.
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.
isn't this the same thing, just reformatted?
|
This plugin has been deployed to Cloudflare R2 and is available for testing. |
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
♻️ Duplicate comments (1)
.github/workflows/push-staging-pr-on-close.yml (1)
21-21: Compare the boolean input as a string to avoid silent mismatch
workflow_dispatchinputs are delivered as strings ('true','false').
The current comparison to the literal boolean true will evaluate to false even when the user passes"true". Recommend string comparison for reliability:-if: (github.event_name == 'pull_request' && github.event.pull_request.merged == true) || (github.event_name == 'workflow_dispatch' && inputs.pr_merged == true) +if: > + (github.event_name == 'pull_request' && + github.event.pull_request.merged == true) || + (github.event_name == 'workflow_dispatch' && + inputs.pr_merged == 'true')
🧹 Nitpick comments (3)
.github/workflows/push-staging-pr-on-close.yml (3)
7-17:defaultis redundant (and misleading) whenrequired: trueBecause the input is required, the dispatcher must explicitly supply a value; the
defaultwill never actually be read. Dropping it avoids confusion:- pr_merged: - description: 'Simulate merged PR' - required: true - type: boolean - default: true + pr_merged: + description: 'Simulate merged PR' + required: true + type: boolean
51-56: Minor shell robustnessConsider adding
set -euo pipefailat the top of this scriptlet to ensure the job fails on any unexpected error (missing variable, failed command, etc.). It’s a cheap guardrail.
58-58: YAML-lint: trailing spacesLine 58 has trailing whitespace. Remove to keep the workflow 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(3 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
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#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: elibosley
PR: unraid/api#1120
File: plugin/package.json:1-8
Timestamp: 2025-02-05T14:43:25.062Z
Learning: The repository uses Renovate for automated dependency updates, making strict version pinning in package.json less critical as updates are handled automatically through PRs.
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 (2)
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#1425
File: api/dev/configs/connect.json:2-3
Timestamp: 2025-06-20T21:05:24.582Z
Learning: When reviewing configuration files in refactoring PRs, avoid suggesting field name changes that could break compatibility with existing code that references those fields, even if the naming doesn't follow ideal conventions.
🪛 YAMLlint (1.37.1)
.github/workflows/push-staging-pr-on-close.yml
[error] 58-58: trailing spaces
(trailing-spaces)
⏰ Context from checks skipped due to timeout of 90000ms (3)
- GitHub Check: Build Web App
- GitHub Check: Test API
- GitHub Check: Cloudflare Pages
🔇 Additional comments (1)
.github/workflows/push-staging-pr-on-close.yml (1)
41-47: Double-check input names supported bydawidd6/action-download-artifact@v11
name_is_regexp,pr, andworkflow_conclusionwere introduced in v6–v10 of the action and occasionally change between major versions. Please verify they still exist onv11; otherwise the step will silently skip the download.
Tested via manual dispatch on #1456 via cli. results in: ```xml <!DOCTYPE PLUGIN [ <!ENTITY name "dynamix.unraid.net"> <!ENTITY launch "Connect"> <!ENTITY author "limetech"> <!ENTITY version "2025.07.03.0623"> <!ENTITY plugin_url "https://preview.dl.unraid.net/unraid-api/dynamix.unraid.net.plg"> <!ENTITY source "/boot/config/plugins/dynamix.my.servers/&txz_name;"> <!ENTITY txz_sha256 "2075cdb8206733f7f037fefdb004a2d719498d6d6d7f3872afd0682a40ceff28"> <!ENTITY txz_url "https://preview.dl.unraid.net/unraid-api/tag/PR1456/dynamix.unraid.net-4.8.0-x86_64-24.txz"> <!ENTITY txz_name "dynamix.unraid.net-4.8.0-x86_64-24.txz"> <!ENTITY arch "x86_64"> <!ENTITY build "24"> <!ENTITY tag "PR1456"> <!ENTITY api_version "4.8.0"> ]> ``` <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Updated workflow input descriptions for consistency. * Expanded job permissions to improve workflow capabilities. * Enhanced artifact download step with additional input options. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
🤖 I have created a release *beep* *boop* --- ## [4.9.0](v4.8.0...v4.9.0) (2025-07-08) ### Features * add graphql resource for API plugins ([#1420](#1420)) ([642a220](642a220)) * add management page for API keys ([#1408](#1408)) ([0788756](0788756)) * add rclone ([#1362](#1362)) ([5517e75](5517e75)) * API key management ([#1407](#1407)) ([d37dc3b](d37dc3b)) * api plugin management via CLI ([#1416](#1416)) ([3dcbfbe](3dcbfbe)) * build out docker components ([#1427](#1427)) ([711cc9a](711cc9a)) * docker and info resolver issues ([#1423](#1423)) ([9901039](9901039)) * fix shading in UPC to be less severe ([#1438](#1438)) ([b7c2407](b7c2407)) * info resolver cleanup ([#1425](#1425)) ([1b279bb](1b279bb)) * initial codeql setup ([#1390](#1390)) ([2ade7eb](2ade7eb)) * initialize claude code in codebse ([#1418](#1418)) ([b6c4ee6](b6c4ee6)) * move api key fetching to use api key service ([#1439](#1439)) ([86bea56](86bea56)) * move to cron v4 ([#1428](#1428)) ([b8035c2](b8035c2)) * move to iframe for changelog ([#1388](#1388)) ([fcd6fbc](fcd6fbc)) * native slackware package ([#1381](#1381)) ([4f63b4c](4f63b4c)) * send active unraid theme to docs ([#1400](#1400)) ([f71943b](f71943b)) * slightly better watch mode ([#1398](#1398)) ([881f1e0](881f1e0)) * upgrade nuxt-custom-elements ([#1461](#1461)) ([345e83b](345e83b)) * use bigint instead of long ([#1403](#1403)) ([574d572](574d572)) ### Bug Fixes * activation indicator removed ([5edfd82](5edfd82)) * alignment of settings on ManagementAccess settings page ([#1421](#1421)) ([70c790f](70c790f)) * allow rclone to fail to initialize ([#1453](#1453)) ([7c6f02a](7c6f02a)) * always download 7.1 versioned files for patching ([edc0d15](edc0d15)) * api `pnpm type-check` ([#1442](#1442)) ([3122bdb](3122bdb)) * **api:** connect config `email` validation ([#1454](#1454)) ([b9a1b9b](b9a1b9b)) * backport unraid/webgui[#2269](https://github.com/unraid/api/issues/2269) rc.nginx update ([#1436](#1436)) ([a7ef06e](a7ef06e)) * bigint ([e54d27a](e54d27a)) * config migration from `myservers.cfg` ([#1440](#1440)) ([c4c9984](c4c9984)) * **connect:** fatal race-condition in websocket disposal ([#1462](#1462)) ([0ec0de9](0ec0de9)) * **connect:** mothership connection ([#1464](#1464)) ([7be8bc8](7be8bc8)) * console hidden ([9b85e00](9b85e00)) * debounce is too long ([#1426](#1426)) ([f12d231](f12d231)) * delete legacy connect keys and ensure description ([22fe91c](22fe91c)) * **deps:** pin dependencies ([#1465](#1465)) ([ba75a40](ba75a40)) * **deps:** pin dependencies ([#1470](#1470)) ([412b329](412b329)) * **deps:** storybook v9 ([#1476](#1476)) ([45bb49b](45bb49b)) * **deps:** update all non-major dependencies ([#1366](#1366)) ([291ee47](291ee47)) * **deps:** update all non-major dependencies ([#1379](#1379)) ([8f70326](8f70326)) * **deps:** update all non-major dependencies ([#1389](#1389)) ([cb43f95](cb43f95)) * **deps:** update all non-major dependencies ([#1399](#1399)) ([68df344](68df344)) * **deps:** update dependency @types/diff to v8 ([#1393](#1393)) ([00da27d](00da27d)) * **deps:** update dependency cache-manager to v7 ([#1413](#1413)) ([9492c2a](9492c2a)) * **deps:** update dependency commander to v14 ([#1394](#1394)) ([106ea09](106ea09)) * **deps:** update dependency diff to v8 ([#1386](#1386)) ([e580f64](e580f64)) * **deps:** update dependency dotenv to v17 ([#1474](#1474)) ([d613bfa](d613bfa)) * **deps:** update dependency lucide-vue-next to ^0.509.0 ([#1383](#1383)) ([469333a](469333a)) * **deps:** update dependency marked to v16 ([#1444](#1444)) ([453a5b2](453a5b2)) * **deps:** update dependency shadcn-vue to v2 ([#1302](#1302)) ([26ecf77](26ecf77)) * **deps:** update dependency vue-sonner to v2 ([#1401](#1401)) ([53ca414](53ca414)) * disable file changes on Unraid 7.2 ([#1382](#1382)) ([02de89d](02de89d)) * do not start API with doinst.sh ([7d88b33](7d88b33)) * do not uninstall fully on 7.2 ([#1484](#1484)) ([2263881](2263881)) * drop console with terser ([a87d455](a87d455)) * error logs from `cloud` query when connect is not installed ([#1450](#1450)) ([719f460](719f460)) * flash backup integration with Unraid Connect config ([#1448](#1448)) ([038c582](038c582)) * header padding regression ([#1477](#1477)) ([e791cc6](e791cc6)) * incorrect state merging in redux store ([#1437](#1437)) ([17b7428](17b7428)) * lanip copy button not present ([#1459](#1459)) ([a280786](a280786)) * move to bigint scalar ([b625227](b625227)) * node_modules dir removed on plugin update ([#1406](#1406)) ([7b005cb](7b005cb)) * omit Connect actions in UPC when plugin is not installed ([#1417](#1417)) ([8c8a527](8c8a527)) * parsing of `ssoEnabled` in state.php ([#1455](#1455)) ([f542c8e](f542c8e)) * pin ranges ([#1460](#1460)) ([f88400e](f88400e)) * pr plugin promotion workflow ([#1456](#1456)) ([13bd9bb](13bd9bb)) * proper fallback if missing paths config modules ([7067e9e](7067e9e)) * rc.unraid-api now cleans up older dependencies ([#1404](#1404)) ([83076bb](83076bb)) * remote access lifecycle during boot & shutdown ([#1422](#1422)) ([7bc583b](7bc583b)) * sign out correctly on error ([#1452](#1452)) ([d08fc94](d08fc94)) * simplify usb listing ([#1402](#1402)) ([5355115](5355115)) * theme issues when sent from graph ([#1424](#1424)) ([75ad838](75ad838)) * **ui:** notifications positioning regression ([#1445](#1445)) ([f73e5e0](f73e5e0)) * use some instead of every for connect detection ([9ce2fee](9ce2fee)) ### Reverts * revert package.json dependency updates from commit 711cc9a for api and packages/* ([94420e4](94420e4)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Summary by CodeRabbit