mirror of
https://github.com/BradNut/awesome-uses
synced 2025-09-08 17:40:31 +00:00
Sometimes action is started because some data.js only some style changes And on generate working tree is empty And action fails because nothing to commit
51 lines
1.3 KiB
YAML
51 lines
1.3 KiB
YAML
name: Populate readme.md from master and lint src/data.js
|
|
|
|
on:
|
|
push:
|
|
branches: master
|
|
paths:
|
|
- src/data.js
|
|
- scripts/readme-template.md
|
|
|
|
env:
|
|
CI: true
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v1
|
|
- uses: actions/setup-node@v1
|
|
with:
|
|
node-version: 13.x
|
|
|
|
- name: Cache/Restore node modules
|
|
uses: actions/cache@v1
|
|
with:
|
|
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
|
|
key: ${{ runner.os }}-npm-${{ hashFiles('package-lock.json') }}
|
|
|
|
- name: Install Dependencies
|
|
run: npm install
|
|
|
|
- name: Lint src/data.js
|
|
run: |
|
|
npx eslint --fix src/data.js
|
|
git add src/data.js
|
|
|
|
- name: Populate readme.md from master
|
|
run: |
|
|
node ./scripts/populate-readme.js
|
|
mv generated-readme.md readme.md
|
|
git add readme.md
|
|
git config --local user.email "action@github.com"
|
|
git config --local user.name "GitHub Action"
|
|
# commit only if any changes
|
|
if [ ! -z "$(git status --porcelain)" ]; then
|
|
git commit -m "chore: generate \`readme.md\`, lint \`src/data.js\`"
|
|
fi
|
|
|
|
- name: Push changes
|
|
uses: ad-m/github-push-action@master
|
|
with:
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|