Changes based on feedback
Signed-off-by: Andre Wanlin <67169551+awanlin@users.noreply.github.com>
This commit is contained in:
@@ -60,18 +60,16 @@ export default async function createPlugin(
|
||||
|
||||
### Configuration
|
||||
|
||||
There is some configuration that needs to be setup to use this action, here are all the settings:
|
||||
There is some configuration that needs to be setup to use this action, these are the base parameters:
|
||||
|
||||
```yaml
|
||||
confluence:
|
||||
baseUrl: 'https://confluence.example.com'
|
||||
auth: 'bearer'
|
||||
token: '${CONFLUENCE_TOKEN}'
|
||||
email: 'example@company.org'
|
||||
username: 'your-username'
|
||||
password: 'your-password'
|
||||
```
|
||||
|
||||
The sections below will go into more details about the Base URL and Auth Methods.
|
||||
|
||||
#### Base URL
|
||||
|
||||
The `baseUrl` for Confluence Cloud should include the product name which is `wiki` by default but can be something else if your Org has changed it. An example `baseUrl` for Confluence Cloud would look like this: `https://example.atlassian.net/wiki`
|
||||
@@ -123,7 +121,7 @@ kind: Template
|
||||
metadata:
|
||||
name: confluence-to-markdown
|
||||
title: Confluence to Markdown
|
||||
description: This template converts a single confluence document to Markdown for Techdocs and adds it to a given GitHub repo.
|
||||
description: This template converts a single Confluence document to Markdown for Techdocs and adds it to a given GitHub repo.
|
||||
tags:
|
||||
- do-not-use
|
||||
- poc
|
||||
@@ -135,10 +133,9 @@ spec:
|
||||
properties:
|
||||
confluenceUrls:
|
||||
type: array
|
||||
description: Urls for confluence doc to be converted to markdown. In format <CONFLUENCE_BASE_URL>/display/<SPACEKEY>/<PAGE+TITLE> or <CONFLUENCE_BASE_URL>/spaces/<SPACEKEY>/pages/<PAGEID>/<PAGE+TITLE> for Confluence cloud
|
||||
description: Urls for Confluence doc to be converted to markdown. In format <CONFLUENCE_BASE_URL>/display/<SPACEKEY>/<PAGE+TITLE> or <CONFLUENCE_BASE_URL>/spaces/<SPACEKEY>/pages/<PAGEID>/<PAGE+TITLE> for Confluence cloud
|
||||
items:
|
||||
type: string
|
||||
default: confluence url
|
||||
ui:options:
|
||||
addable: true
|
||||
minItems: 1
|
||||
@@ -161,7 +158,7 @@ spec:
|
||||
repoUrl: <GITHUB_BASE_URL>?repo=${{ steps['create-docs'].output.repo }}&owner=${{ steps['create-docs'].output.owner }}
|
||||
branchName: confluence-to-markdown
|
||||
title: Confluence to Markdown
|
||||
description: PR for converting confluence page to mkdocs
|
||||
description: PR for converting Confluence page to mkdocs
|
||||
```
|
||||
|
||||
Replace `<GITHUB_BASE_URL>` with your GitHub URL without `https://`.
|
||||
|
||||
@@ -31,7 +31,7 @@ export interface Config {
|
||||
*/
|
||||
token?: string;
|
||||
/**
|
||||
* Email encoded with the token for the bearer auth method
|
||||
* Email used with the token for the basic auth method
|
||||
* @visibility secret
|
||||
*/
|
||||
email?: string;
|
||||
|
||||
@@ -3,7 +3,7 @@ kind: Template
|
||||
metadata:
|
||||
name: confluence-to-markdown
|
||||
title: Confluence to Markdown
|
||||
description: This template converts a single confluence document to Markdown for Techdocs and adds it to a given GitHub repo.
|
||||
description: This template converts a single Confluence document to Markdown for Techdocs and adds it to a given GitHub repo.
|
||||
tags:
|
||||
- do-not-use
|
||||
- poc
|
||||
@@ -15,10 +15,9 @@ spec:
|
||||
properties:
|
||||
confluenceUrls:
|
||||
type: array
|
||||
description: Urls for confluence doc to be converted to markdown. In format <CONFLUENCE_BASE_URL>/display/<SPACEKEY>/<PAGE+TITLE> or <CONFLUENCE_BASE_URL>/spaces/<SPACEKEY>/pages/<PAGEID>/<PAGE+TITLE> for Confluence cloud
|
||||
description: URLs for Confluence doc to be converted to markdown. In format <CONFLUENCE_BASE_URL>/display/<SPACEKEY>/<PAGE+TITLE> or <CONFLUENCE_BASE_URL>/spaces/<SPACEKEY>/pages/<PAGEID>/<PAGE+TITLE> for Confluence cloud
|
||||
items:
|
||||
type: string
|
||||
default: confluence url
|
||||
ui:options:
|
||||
addable: true
|
||||
minItems: 1
|
||||
@@ -41,4 +40,4 @@ spec:
|
||||
repoUrl: <GITHUB_BASE_URL>?repo=${{ steps['create-docs'].output.repo }}&owner=${{ steps['create-docs'].output.owner }}
|
||||
branchName: confluence-to-markdown
|
||||
title: Confluence to Markdown
|
||||
description: PR for converting confluence page to mkdocs
|
||||
description: PR for converting Confluence page to mkdocs
|
||||
|
||||
+1
-1
@@ -58,7 +58,7 @@ export const createConfluenceToMarkdownAction = (options: {
|
||||
type: 'array',
|
||||
title: 'Confluence URL',
|
||||
description:
|
||||
'Paste your confluence url. Ensure it follows this format: https://{confluence+base+url}/display/{spacekey}/{page+title} or https://{confluence+base+url}/spaces/{spacekey}/pages/1234567/{page+title} for Confluence Cloud',
|
||||
'Paste your Confluence url. Ensure it follows this format: https://{confluence+base+url}/display/{spacekey}/{page+title} or https://{confluence+base+url}/spaces/{spacekey}/pages/1234567/{page+title} for Confluence Cloud',
|
||||
items: {
|
||||
type: 'string',
|
||||
default: 'Confluence URL',
|
||||
|
||||
+3
-8
@@ -90,28 +90,23 @@ export const getConfluenceConfig = (config: Config) => {
|
||||
};
|
||||
|
||||
export const getAuthorizationHeaderValue = (config: ConfluenceConfig) => {
|
||||
let authHeaderValue: string = '';
|
||||
switch (config.auth) {
|
||||
case 'bearer':
|
||||
authHeaderValue = `Bearer ${config.token}`;
|
||||
break;
|
||||
return `Bearer ${config.token}`;
|
||||
case 'basic': {
|
||||
const buffer = Buffer.from(`${config.email}:${config.token}`, 'utf8');
|
||||
authHeaderValue = `Basic ${buffer.toString('base64')}`;
|
||||
break;
|
||||
return `Basic ${buffer.toString('base64')}`;
|
||||
}
|
||||
case 'userpass': {
|
||||
const buffer = Buffer.from(
|
||||
`${config.username}:${config.password}`,
|
||||
'utf8',
|
||||
);
|
||||
authHeaderValue = `Basic ${buffer.toString('base64')}`;
|
||||
break;
|
||||
return `Basic ${buffer.toString('base64')}`;
|
||||
}
|
||||
default:
|
||||
throw new Error(`Unknown auth method '${config.auth}' provided`);
|
||||
}
|
||||
return authHeaderValue;
|
||||
};
|
||||
|
||||
export const readFileAsString = async (fileDir: string) => {
|
||||
|
||||
Reference in New Issue
Block a user