From 4c64f2460053d52100685b7f5a280ec6a8a69999 Mon Sep 17 00:00:00 2001 From: Izan Gil <66965250+SrIzan10@users.noreply.github.com> Date: Tue, 5 Sep 2023 13:28:41 +0200 Subject: [PATCH] feat: website docs generation and instability fix --- index.ts | 2 ++ scripts/updateDocsJson.sh | 24 ++++++++++-------------- util/setup.sh | 7 +++++++ 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/index.ts b/index.ts index 6d40ed6..1a35cdd 100644 --- a/index.ts +++ b/index.ts @@ -26,6 +26,8 @@ app.post('/wh/updateDocsJson', async (req, res) => { success: true, error: 'Token valid, but ignoring action...' }) + // this line fixed the entire instability of automata + return; } execa('bash', ['scripts/updateDocsJson.sh', process.env.GHTOKEN!, process.env.EMAIL!], { shell: true }) res.send({ diff --git a/scripts/updateDocsJson.sh b/scripts/updateDocsJson.sh index 26059e7..b069572 100644 --- a/scripts/updateDocsJson.sh +++ b/scripts/updateDocsJson.sh @@ -1,26 +1,22 @@ #!/bin/bash cd repos/sern-community +git checkout main git pull -# merge all changes from main to docsjson to be updated -git checkout docsjson -git merge main -git -c user.name="sern bot" -c user.email="$2" commit -m "chore: merge changes from main" -git push https://sernbot:$1@github.com/sern-handler/sern-community.git cd .. cd website +mv ./docusaurus.config.js ./original.docusaurus.config.js +mv ./docgen.docusaurus.config.js ./docusaurus.config.js +npm run build +mv docusaurus.config.js docgen.docusaurus.config.js +mv original.docusaurus.config.js docusaurus.config.js npm run typedoc-json +git add . +git -c user.name="sern bot" -c user.email="$2" commit -m "chore: update api documentation" +git push https://sernbot:$1@github.com/sern-handler/website.git cd .. cd sern-community git add . git -c user.name="sern bot" -c user.email="$2" commit -m "chore: update typedoc" -git push https://sernbot:$1@github.com/sern-handler/sern-community.git -curl -L \ - -X POST \ - -H "Accept: application/vnd.github+json" \ - -H "Authorization: Bearer $1" \ - -H "X-GitHub-Api-Version: 2022-11-28" \ - https://api.github.com/repos/sern-handler/sern-community/pulls \ - -d '{"title":"chore: update typedoc","body":"automated typedoc update (as of the new latest update in the handler)","head":"docsjson","base":"main"}' -git checkout main \ No newline at end of file +git push https://sernbot:$1@github.com/sern-handler/sern-community.git \ No newline at end of file diff --git a/util/setup.sh b/util/setup.sh index e3e852c..4dd7c08 100644 --- a/util/setup.sh +++ b/util/setup.sh @@ -9,6 +9,13 @@ mkdir repos cd repos echo " done" +if [$IS_SRIZAN == "true"] +then + echo -ne "Detected Sr Izan on development environment. chowning repos folder" + sudo chown -R srizan:srizan . + echo " done" +fi + echo -ne "Installing sern CLI" npm install -g @sern/cli echo " done"