Skip to content

Commit

Permalink
feat(ci): create workflow for README\s
Browse files Browse the repository at this point in the history
  • Loading branch information
NeonGamerBot-QK committed Aug 30, 2024
1 parent 0b89a70 commit 0eb4554
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/readme.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build readme's

on:
push:
branches:
- main
pull_request:
branches:
- main

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: Run tests
run: node fix_readmes.js
11 changes: 11 additions & 0 deletions README.template
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[![wakatime](https://wakatime.com/badge/github/NeonGamerBot-QK/apcsa.svg)](https://wakatime.com/badge/github/NeonGamerBot-QK/apcsa)
![Java](https://img.shields.io/badge/java-%23ED8B00.svg?style=for-the-badge&logo=openjdk&logoColor=white)

## APCSA

This repository contains all my files for my APCS A class.

### Table of contents:
{contents}


12 changes: 12 additions & 0 deletions fix_readmes.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const fs = require('fs')

const filesWhichAreDirs = fs.readdirSync('./').filter(file => fs.lstatSync(file).isDirectory())

const projectsInMd = filesWhichAreDirs.filter(dir => {
if (['.github', 'target'].includes(dir)) return false;
return true;
}).map(dir => `- [**${dir}**](./${dir}/README.md)`).join('\n')

fs.writeFileSync('./README.md', fs.readFileSync('./README.template').toString().replace('{content}', projectsInMd))

require('child_process').execSync('git add . && git commit -m "ci(zeon): Update README.md" && git push')

0 comments on commit 0eb4554

Please sign in to comment.