Skip to content

Time: 1 ms (93.94%), Space: 42.8 MB (57.58%) - LeetHub #1088

Time: 1 ms (93.94%), Space: 42.8 MB (57.58%) - LeetHub

Time: 1 ms (93.94%), Space: 42.8 MB (57.58%) - LeetHub #1088

Workflow file for this run

name: Generate Table of Contents
on:
# Runs on pushes targeting the default branch
push:
branches: ["main"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: "20"
- name: Install dependencies
run: npm install
working-directory: scripts
- name: Run table-of-contents.js
run: npm run generate-table-of-contents
working-directory: scripts
- name: Replace README.md in root
run: |
if cp scripts/README.md README.md; then
echo "README.md replaced successfully"
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
git add README.md
git commit -m "Update README with table of contents"
git push
else
echo "Failed to replace README.md"
exit 1
fi
working-directory: ${{ github.workspace }}