diff --git a/.github/workflows/docs-checks.yml b/.github/workflows/docs-checks.yml index fd738fa90..237c02714 100644 --- a/.github/workflows/docs-checks.yml +++ b/.github/workflows/docs-checks.yml @@ -4,6 +4,13 @@ on: pull_request: push: branches: [main] + # "Run workflow" in the Actions tab: runs the examples on every page. + workflow_dispatch: + inputs: + image: + description: Memgraph MAGE image (default is the newest release in the release notes) + required: false + default: '' permissions: contents: read @@ -13,8 +20,8 @@ jobs: name: Links, redirects and sidebar runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - uses: actions/checkout@v7 + - uses: actions/setup-node@v7 with: node-version: 22 - run: node scripts/check-docs.mjs @@ -26,7 +33,7 @@ jobs: if: github.event_name == 'pull_request' && github.base_ref == 'main' runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v7 with: fetch-depth: 2 # The pages this PR changes: their Cypher examples run on the latest Memgraph, and the names in them are checked. @@ -34,3 +41,16 @@ jobs: env: MEMGRAPH_ENTERPRISE_LICENSE: ${{ secrets.MEMGRAPH_ENTERPRISE_LICENSE }} MEMGRAPH_ORGANIZATION_NAME: ${{ secrets.MEMGRAPH_ORGANIZATION_NAME }} + + all-examples: + name: Examples and names on every page + if: github.event_name == 'workflow_dispatch' + runs-on: ubuntu-latest + timeout-minutes: 120 + steps: + - uses: actions/checkout@v7 + - run: python3 scripts/check-examples.py --all ${IMAGE:+--image "$IMAGE"} + env: + IMAGE: ${{ inputs.image }} + MEMGRAPH_ENTERPRISE_LICENSE: ${{ secrets.MEMGRAPH_ENTERPRISE_LICENSE }} + MEMGRAPH_ORGANIZATION_NAME: ${{ secrets.MEMGRAPH_ORGANIZATION_NAME }} diff --git a/scripts/check-examples.py b/scripts/check-examples.py index 861989288..0971ab693 100644 --- a/scripts/check-examples.py +++ b/scripts/check-examples.py @@ -460,7 +460,8 @@ def message(r): return EXPLAIN.get(r['kind'], r['kind']) + (f": {r['msg']}" if r['msg'] else '') -for title, rs, level in (('In the blocks this change touches', failing, 'error'), +whole = a.all or bool(a.pages) +for title, rs, level in (('Problems' if whole else 'In the blocks this change touches', failing, 'error'), ('Elsewhere on the changed pages (not failing)', others, 'warning')): if not rs: continue @@ -482,5 +483,5 @@ def message(r): with open(os.environ['GITHUB_STEP_SUMMARY'], 'a') as f: f.write(scrub('\n'.join(summary)) + '\n') -print(f'\n{len(failing)} problem(s) in changed blocks, {len(others)} elsewhere on the changed pages.') +print(f'\n{len(failing)} problem(s).' if whole else f'\n{len(failing)} problem(s) in changed blocks, {len(others)} elsewhere on the changed pages.') sys.exit(1 if failing else 0)