-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add config files to log error of example pages (#963)
- Loading branch information
1 parent
7cddc9e
commit 7f44dbd
Showing
3 changed files
with
69 additions
and
1 deletion.
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,31 @@ | ||
name: detect runtime error | ||
|
||
on: | ||
schedule: | ||
- cron: '0 22 * * *' | ||
jobs: | ||
makeUrl: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout repository | ||
uses: actions/checkout@v2 | ||
- name: create config variable | ||
run: | | ||
node apps/editor/scripts/createConfigVariable.js | ||
- name: set global error variable | ||
run: | | ||
errorVariable=`cat ./errorVariable.txt` | ||
echo ::set-env name=ERROR_VARIABLE::$errorVariable | ||
- name: set url | ||
shell: bash | ||
run: | | ||
url=`cat ./url.txt` | ||
echo ::set-env name=URLS::$url | ||
- name: detect runtime error | ||
uses: nhn/toast-ui.detect-runtime-error-actions@master | ||
with: | ||
global-error-log-variable: ${{ env.ERROR_VARIABLE }} | ||
urls: ${{ env.URLS }} | ||
env: | ||
BROWSERSTACK_USERNAME: ${{secrets.BROWSERSTACK_USERNAME}} | ||
BROWSERSTACK_ACCESS_KEY: ${{secrets.BROWSERSTACK_ACCESS_KEY}} |
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,36 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const config = require(path.resolve(process.cwd(), 'tuidoc.config.json')); | ||
const examples = config.examples || {}; | ||
const { filePath, globalErrorLogVariable } = examples; | ||
|
||
/** | ||
* Get Examples Url | ||
*/ | ||
function getTestUrls() { | ||
if (!filePath) { | ||
throw Error('not exist examples path at tuidoc.config.json'); | ||
} | ||
|
||
const urlPrefix = 'http://nhn.github.io/tui.editor/latest'; | ||
|
||
const testUrls = fs.readdirSync(filePath).reduce((urls, fileName) => { | ||
if (/html$/.test(fileName)) { | ||
urls.push(`${urlPrefix}/${filePath}/${fileName}`); | ||
} | ||
return urls; | ||
}, []); | ||
|
||
fs.writeFileSync('url.txt', testUrls.join(', ')); | ||
} | ||
|
||
function getGlobalVariable() { | ||
if (!globalErrorLogVariable) { | ||
throw Error('not exist examples path at tuidoc.config.json'); | ||
} | ||
|
||
fs.writeFileSync('errorVariable.txt', globalErrorLogVariable); | ||
} | ||
|
||
getTestUrls(); | ||
getGlobalVariable(); |
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