Build README.md #94
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build README.md | |
on: | |
# on push to the repository | |
push: | |
# can be triggered manually | |
workflow_dispatch: | |
# on a schedule at 7pm every weekday | |
schedule: | |
- cron: "0 19 * * 1-5" | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20" | |
- name: Configure NPM caching | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
npm- | |
- name: Install NPM dependencies | |
run: npm ci | |
- name: Update README.md | |
run: |- | |
npm run build | |
cat profile/README.md | |
- name: Commit and push if on `main` and changes exist | |
if: github.ref == 'refs/heads/main' | |
run: |- | |
git diff | |
git config --global user.email "[email protected]" | |
git config --global user.name "Smartclip GitHub Profile Updater" | |
git commit -am "chore: update `README` jobs [no-ci]" || exit 0 | |
git push |