Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/actions/update-version-durability/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ inputs:
D360_ARTICLE_ID:
required: true
description: Document360 Article ID
D360_USER_ID:
required: true
description: Document360 User ID used to fork and publish the article
PUBLISH:
required: true
description: Publish Draft
Expand Down
9 changes: 7 additions & 2 deletions .github/actions/update-version-durability/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { Octokit } from '@octokit/rest';

const D360_TOKEN = core.getInput('D360_TOKEN');
const D360_ARTICLE_ID = core.getInput('D360_ARTICLE_ID');
const D360_USER_ID = core.getInput('D360_USER_ID');

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Validate that D360_USER_ID is not empty.

If the repository secret D360_USER_ID is not configured, the input will be an empty string. The workflow would then fail at API call time (line 195) with a Document360 error rather than a clear validation error. Adding an upfront check provides immediate, actionable feedback.

✅ Proposed validation
 const D360_USER_ID = core.getInput('D360_USER_ID');
+if (!D360_USER_ID) {
+  throw new Error('D360_USER_ID input is required but was not provided');
+}
 const PUBLISH = core.getInput('PUBLISH') === 'true';
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/actions/update-version-durability/index.js at line 14, Validate that
the D360_USER_ID input (obtained via core.getInput('D360_USER_ID')) is non-empty
immediately after retrieval; if it is empty, call core.setFailed with a clear
message (or throw a descriptive Error) and exit so the action fails fast with
actionable feedback instead of letting the API call at Document360 fail later.
Ensure the check is placed right after the const D360_USER_ID =
core.getInput('D360_USER_ID'); line and use the same symbol name in the error
message for clarity.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2: Missing { required: true } option on core.getInput('D360_USER_ID'). Since D360_USER_ID is a required secret (per PR description), omitting the required flag means an unset secret produces a misleading Document360 API error instead of a clear startup failure.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At .github/actions/update-version-durability/index.js, line 14:

<comment>Missing `{ required: true }` option on `core.getInput('D360_USER_ID')`. Since D360_USER_ID is a required secret (per PR description), omitting the `required` flag means an unset secret produces a misleading Document360 API error instead of a clear startup failure.</comment>

<file context>
@@ -11,6 +11,7 @@ import { Octokit } from '@octokit/rest';
 
 const D360_TOKEN = core.getInput('D360_TOKEN');
 const D360_ARTICLE_ID = core.getInput('D360_ARTICLE_ID');
+const D360_USER_ID = core.getInput('D360_USER_ID');
 const PUBLISH = core.getInput('PUBLISH') === 'true';
 const LTS_VERSIONS = (core.getInput('LTS_VERSIONS') || '7.10').split(',').map((v) => v.trim());
</file context>
Suggested change
const D360_USER_ID = core.getInput('D360_USER_ID');
const D360_USER_ID = core.getInput('D360_USER_ID', { required: true });

const PUBLISH = core.getInput('PUBLISH') === 'true';
const LTS_VERSIONS = (core.getInput('LTS_VERSIONS') || '7.10').split(',').map((v) => v.trim());

Expand Down Expand Up @@ -193,11 +194,15 @@ async function generateTable({ owner, repo } = {}) {

const forkResponse = await requestDocument360('put', `Articles/${D360_ARTICLE_ID}/fork`, {
lang_code: "en",
user_id: "2511fd00-9558-4826-8d8c-4cc0c110f89c",
user_id: D360_USER_ID,
version_number: response.data.data.version_number,
});

console.log(forkResponse.data);

if (!forkResponse.data.success) {
throw new Error(`Failed to fork article: ${JSON.stringify(forkResponse.data.errors)}`);
}
}

console.log('Updating article');
Expand All @@ -211,7 +216,7 @@ async function generateTable({ owner, repo } = {}) {
console.log('publishing article', updateResponse.data.data.version_number);

const forkResponse = await requestDocument360('post', `Articles/${D360_ARTICLE_ID}/en/publish`, {
user_id: "2511fd00-9558-4826-8d8c-4cc0c110f89c",
user_id: D360_USER_ID,
version_number: updateResponse.data.data.version_number,
publish_message: 'Update support versions table via GitHub Action',
});
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1100,3 +1100,4 @@ jobs:
secrets:
CI_PAT: ${{ secrets.CI_PAT }}
D360_TOKEN: ${{ secrets.D360_TOKEN }}
D360_USER_ID: ${{ secrets.D360_USER_ID }}
3 changes: 3 additions & 0 deletions .github/workflows/update-version-durability.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ on:
required: true
D360_TOKEN:
required: true
D360_USER_ID:
required: true

jobs:
update-versions:
Expand All @@ -37,4 +39,5 @@ jobs:
GH_TOKEN: ${{ secrets.CI_PAT }}
D360_TOKEN: ${{ secrets.D360_TOKEN }}
D360_ARTICLE_ID: 800f8d52-409d-478d-b560-f82a2c0eb7fb
D360_USER_ID: ${{ secrets.D360_USER_ID }}
PUBLISH: true
Loading