Skip to content

Commit c5bd1fc

Browse files
authored
chore: docs PR previews (#1563)
1 parent fd1d7fe commit c5bd1fc

File tree

4 files changed

+49
-11
lines changed

4 files changed

+49
-11
lines changed

.github/workflows/pr-previews.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Docs PR Previews
2+
3+
on:
4+
pull_request:
5+
types: [opened, synchronize, reopened, closed]
6+
7+
concurrency:
8+
cancel-in-progress: false
9+
group: 'docs-pr-previews-${{ github.event.pull_request.number }}'
10+
11+
jobs:
12+
trigger-preview:
13+
if: github.event.action != 'closed'
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Trigger preview
19+
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 }}
20+
env:
21+
GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
22+
23+
delete-preview:
24+
if: github.event.action == 'closed'
25+
26+
runs-on: ubuntu-latest
27+
28+
steps:
29+
- name: Delete preview
30+
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
31+
env:
32+
GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}

apify-docs-theme/src/config.js

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,16 @@
11
/* eslint-disable global-require */
2-
// eslint-disable-next-line no-nested-ternary
3-
const absoluteUrl = process.env.LOCALHOST
4-
? 'http://localhost:3000'
5-
: process.env.DEV
6-
? 'http://docs.apify.loc'
7-
: 'https://docs.apify.com';
82

9-
const themeConfig = ({
3+
let absoluteUrl = 'https://docs.apify.com';
4+
5+
if (process.env.LOCALHOST) {
6+
absoluteUrl = 'http://localhost:3000';
7+
} else if (process.env.DEV) {
8+
absoluteUrl = 'http://docs.apify.loc';
9+
} else if (process.env.APIFY_DOCS_ABSOLUTE_URL) {
10+
absoluteUrl = process.env.APIFY_DOCS_ABSOLUTE_URL;
11+
}
12+
13+
const themeConfig = {
1014
docs: {
1115
versionPersistence: 'localStorage',
1216
sidebar: {
@@ -277,7 +281,7 @@ const themeConfig = ({
277281
async: true,
278282
defer: true,
279283
},
280-
});
284+
};
281285

282286
const plugins = [
283287
[
@@ -294,7 +298,9 @@ const plugins = [
294298
return {
295299
resolveLoader: {
296300
alias: {
297-
'roa-loader': require.resolve(`${__dirname}/roa-loader/`),
301+
'roa-loader': require.resolve(
302+
`${__dirname}/roa-loader/`,
303+
),
298304
},
299305
},
300306
};

docusaurus.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ module.exports = {
257257
module: {
258258
rules: [
259259
{
260-
test: /apify-docs\/examples\//i,
260+
test: /examples\//i,
261261
type: 'asset/source',
262262
},
263263
],

examples/ts-parallel-scraping/orchestrator/src/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ if (state.isInitialized) {
5959
state.isInitialized = true;
6060
}
6161

62-
const parallelRunPromises = state.parallelRunIds.map((runId) => {
62+
const parallelRunPromises = state.parallelRunIds.map(async (runId) => {
6363
const runClient = apifyClient.run(runId);
6464
return runClient.waitForFinish();
6565
});

0 commit comments

Comments
 (0)