diff --git a/.github/workflows/pr-previews.yaml b/.github/workflows/pr-previews.yaml new file mode 100644 index 0000000000..6deca05aa2 --- /dev/null +++ b/.github/workflows/pr-previews.yaml @@ -0,0 +1,32 @@ +name: Docs PR Previews + +on: + pull_request: + types: [opened, synchronize, reopened, closed] + +concurrency: + cancel-in-progress: false + group: 'docs-pr-previews-${{ github.event.pull_request.number }}' + +jobs: + trigger-preview: + if: github.event.action != 'closed' + + runs-on: ubuntu-latest + + steps: + - name: Trigger preview + run: gh workflow run apify_docs_pr.yml --repo apify/apify-docs-private --field pr-number=${{ github.event.pull_request.number }} --field original-repository=${{ github.repository }} + env: + GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} + + delete-preview: + if: github.event.action == 'closed' + + runs-on: ubuntu-latest + + steps: + - name: Delete preview + run: gh workflow run apify_docs_pr.yml --repo apify/apify-docs-private --field pr-number=${{ github.event.pull_request.number }} --field original-repository=${{ github.repository }} --field action=delete + env: + GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} diff --git a/apify-docs-theme/src/config.js b/apify-docs-theme/src/config.js index 434532a582..4195006c20 100644 --- a/apify-docs-theme/src/config.js +++ b/apify-docs-theme/src/config.js @@ -1,12 +1,16 @@ /* eslint-disable global-require */ -// eslint-disable-next-line no-nested-ternary -const absoluteUrl = process.env.LOCALHOST - ? 'http://localhost:3000' - : process.env.DEV - ? 'http://docs.apify.loc' - : 'https://docs.apify.com'; -const themeConfig = ({ +let absoluteUrl = 'https://docs.apify.com'; + +if (process.env.LOCALHOST) { + absoluteUrl = 'http://localhost:3000'; +} else if (process.env.DEV) { + absoluteUrl = 'http://docs.apify.loc'; +} else if (process.env.APIFY_DOCS_ABSOLUTE_URL) { + absoluteUrl = process.env.APIFY_DOCS_ABSOLUTE_URL; +} + +const themeConfig = { docs: { versionPersistence: 'localStorage', sidebar: { @@ -277,7 +281,7 @@ const themeConfig = ({ async: true, defer: true, }, -}); +}; const plugins = [ [ @@ -294,7 +298,9 @@ const plugins = [ return { resolveLoader: { alias: { - 'roa-loader': require.resolve(`${__dirname}/roa-loader/`), + 'roa-loader': require.resolve( + `${__dirname}/roa-loader/`, + ), }, }, }; diff --git a/docusaurus.config.js b/docusaurus.config.js index df71d853c4..7939878011 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -257,7 +257,7 @@ module.exports = { module: { rules: [ { - test: /apify-docs\/examples\//i, + test: /examples\//i, type: 'asset/source', }, ], diff --git a/examples/ts-parallel-scraping/orchestrator/src/main.ts b/examples/ts-parallel-scraping/orchestrator/src/main.ts index 117b8172ba..6c9d2c287e 100644 --- a/examples/ts-parallel-scraping/orchestrator/src/main.ts +++ b/examples/ts-parallel-scraping/orchestrator/src/main.ts @@ -59,7 +59,7 @@ if (state.isInitialized) { state.isInitialized = true; } -const parallelRunPromises = state.parallelRunIds.map((runId) => { +const parallelRunPromises = state.parallelRunIds.map(async (runId) => { const runClient = apifyClient.run(runId); return runClient.waitForFinish(); });