Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
sarahschwartz committed Oct 23, 2023
1 parent 311248d commit 8c166d6
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 25 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/guides.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,6 @@ jobs:
- name: Lint Check
run: markdownlint --config .markdownlint.yaml --ignore-path .markdownlintignore '**/*.mdx'

## CHECKS ALL LINKS IN GUIDES
## RUNS AFTER VERCEL LINK IS DEPLOYED
check-links:
name: Check Links
runs-on: ubuntu-latest
steps:
# SETUP & INSTALL
- name: Checkout repo
uses: actions/checkout@v3
- uses: ./.github/actions/setup-node
with:
install: false
# RUN SCRIPT TO GENERATE NEW CONFIG WITH VERCEL PREVIEW URL
# RUN LINK CHECK
- uses: gaurav-nelson/github-action-markdown-link-check
with:
config-file: 'mlc-config.json'
file-extension: 'mdx'
use-verbose-mode: 'yes'
folder-path: docs/guides/docs

## QUICKSTART TEST
quickstart-test:
timeout-minutes: 30
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/links.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Links

on:
workflow_run:
workflows: [Vercel]
types:
- completed

jobs:
## CHECKS ALL LINKS IN GUIDES
## RUNS AFTER VERCEL LINK IS DEPLOYED
check-links:
name: Check Links
runs-on: ubuntu-latest
steps:
# SETUP & INSTALL
- name: Checkout repo
uses: actions/checkout@v3
- uses: ./.github/actions/setup-node
with:
install: false
# RUN SCRIPT TO USE VERCEL PREVIEW LINK FROM PR
- name: Update preview link
run: node scripts/generate-mlc-config.mjs {{ github.head_ref }}
# RUN SCRIPT TO GENERATE NEW CONFIG WITH VERCEL PREVIEW URL
# RUN LINK CHECK
- uses: gaurav-nelson/github-action-markdown-link-check
with:
config-file: 'mlc-config.json'
file-extension: 'mdx'
# use-verbose-mode: 'yes'
folder-path: docs/guides/docs
2 changes: 1 addition & 1 deletion mlc-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"replacementPatterns": [
{
"pattern": "^(/)(.*)",
"replacement": "https://docs-hub-git-sarah-lint-fuel-labs.vercel.app/$2"
"replacement": "https://docs-hub-git-{{BRANCH}}-fuel-labs.vercel.app/$2"
}
]
}
12 changes: 12 additions & 0 deletions scripts/generate-mlc-config.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import fs from 'fs';

main();

function main() {
const configPath = './mlc-config-test.json';
const branchName = process.argv[2].replaceAll('/', '-').toLowerCase();
console.log('BRANCH NAME:', branchName);
const configFile = fs.readFileSync(configPath, 'utf-8');
const newContent = configFile.replace('{{BRANCH}}', branchName);
fs.writeFileSync(configPath, newContent);
}
3 changes: 0 additions & 3 deletions scripts/update-latest-submodules.sh

This file was deleted.

0 comments on commit 8c166d6

Please sign in to comment.