-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge pull request #14 from go-vela/feat/plugins
feat: local and remote plugins
Showing
13 changed files
with
439 additions
and
325 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# GitHub Enterprise PAT used to fetch from git.target.com | ||
GHE_PAT=ghp_1234567890abcdefghij | ||
GHE_API_URL=https://git.target.com/api/v3 | ||
|
||
# GitHub PAT used to fetch from github.com | ||
GITHUB_PAT=ghp_1234567890abcdefghij |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import remoteVelaPlugins from "./plugins.js"; | ||
import { validateEnvironment, moveLocalPluginsToDocs, modifyRemoteContent } from "./utils.js"; | ||
|
||
// this file acts as the glue for taking a combination of local plugin docs and remote downloaded docs | ||
// to produce a set of final documents that end up in docs/plugins | ||
|
||
// the code in this file runs when docusarus builds the static site | ||
|
||
require("dotenv").config(); | ||
|
||
validateEnvironment(remoteVelaPlugins); | ||
|
||
const localPluginsSourceDir = "remote-vela-plugins/local"; | ||
const allPluginsDestinationDir = "docs/usage/plugins/registry"; | ||
|
||
moveLocalPluginsToDocs(localPluginsSourceDir, allPluginsDestinationDir); | ||
|
||
function fetchRemoteContentPlugin(plugin) { | ||
return [ | ||
"docusaurus-plugin-remote-content", | ||
{ | ||
performCleanup: true, | ||
name: "plugin-content-" + plugin.name, | ||
sourceBaseUrl: plugin.internal ? | ||
`${process.env.GHE_API_URL}/repos/${plugin.sourceRepo}/contents/` : | ||
`https://api.github.com/repos/${plugin.sourceRepo}/contents/`, | ||
requestConfig: { | ||
headers: { | ||
"Authorization": "Bearer " + (plugin.internal ? | ||
process.env.GHE_PAT : | ||
process.env.GITHUB_PAT), | ||
}, | ||
params: { | ||
ref: plugin.sourceRef, | ||
}, | ||
}, | ||
outDir: allPluginsDestinationDir, | ||
documents: [plugin.sourceFileName], | ||
modifyContent: modifyRemoteContent(plugin), | ||
}, | ||
]; | ||
} | ||
|
||
const remoteContentVelaPlugins = remoteVelaPlugins.map(fetchRemoteContentPlugin); | ||
|
||
export default remoteContentVelaPlugins; |
Oops, something went wrong.