Skip to content

Commit f3fc9df

Browse files
authored
ci: make Document360 user id configurable via CI secret (#40881)
1 parent efdefa6 commit f3fc9df

4 files changed

Lines changed: 14 additions & 2 deletions

File tree

.github/actions/update-version-durability/action.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ inputs:
1414
D360_ARTICLE_ID:
1515
required: true
1616
description: Document360 Article ID
17+
D360_USER_ID:
18+
required: true
19+
description: Document360 User ID used to fork and publish the article
1720
PUBLISH:
1821
required: true
1922
description: Publish Draft

.github/actions/update-version-durability/index.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import { Octokit } from '@octokit/rest';
1111

1212
const D360_TOKEN = core.getInput('D360_TOKEN');
1313
const D360_ARTICLE_ID = core.getInput('D360_ARTICLE_ID');
14+
const D360_USER_ID = core.getInput('D360_USER_ID');
1415
const PUBLISH = core.getInput('PUBLISH') === 'true';
1516
const LTS_VERSIONS = (core.getInput('LTS_VERSIONS') || '7.10').split(',').map((v) => v.trim());
1617

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

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

200201
console.log(forkResponse.data);
202+
203+
if (!forkResponse.data.success) {
204+
throw new Error(`Failed to fork article: ${JSON.stringify(forkResponse.data.errors)}`);
205+
}
201206
}
202207

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

213218
const forkResponse = await requestDocument360('post', `Articles/${D360_ARTICLE_ID}/en/publish`, {
214-
user_id: "2511fd00-9558-4826-8d8c-4cc0c110f89c",
219+
user_id: D360_USER_ID,
215220
version_number: updateResponse.data.data.version_number,
216221
publish_message: 'Update support versions table via GitHub Action',
217222
});

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1100,3 +1100,4 @@ jobs:
11001100
secrets:
11011101
CI_PAT: ${{ secrets.CI_PAT }}
11021102
D360_TOKEN: ${{ secrets.D360_TOKEN }}
1103+
D360_USER_ID: ${{ secrets.D360_USER_ID }}

.github/workflows/update-version-durability.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ on:
1212
required: true
1313
D360_TOKEN:
1414
required: true
15+
D360_USER_ID:
16+
required: true
1517

1618
jobs:
1719
update-versions:
@@ -37,4 +39,5 @@ jobs:
3739
GH_TOKEN: ${{ secrets.CI_PAT }}
3840
D360_TOKEN: ${{ secrets.D360_TOKEN }}
3941
D360_ARTICLE_ID: 800f8d52-409d-478d-b560-f82a2c0eb7fb
42+
D360_USER_ID: ${{ secrets.D360_USER_ID }}
4043
PUBLISH: true

0 commit comments

Comments
 (0)