Create practical-ai-299.md #1698
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
# This workflow runs the `format` script on the codebase when | |
# code is pushed to master. | |
name: Run Formatter on episode transcripts | |
on: | |
push: | |
branches: [ master ] | |
workflow_dispatch: # create a button to run on demand | |
jobs: | |
run-formatter: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Use Node.js 14.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 14.x | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: cache-node-modules | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- name: run npm install | |
run: npm install | |
- name: run formatter | |
run: npm run format | |
- name: Commit and push if it changed | |
run: |- | |
git config user.name "Logbot" | |
git config user.email "[email protected]" | |
git add -A | |
git commit -m "$(npm run commitMessage --silent)" || exit 0 | |
git push | |
## Alternative to Automatic Push. | |
## Left here in case we ever want to go back to PR instead of push | |
# - name: Create Pull Request | |
# uses: peter-evans/create-pull-request@v3 | |
# with: | |
# commit-message: Apply standardized formatter to transcripts | |
# title: Apply standardized formatter to transcripts | |
# body: |- | |
# This pull request was automatically generated by a GitHub Action. | |
# It ran `npm run format` after the last push to master, which was | |
# *${{ github.event.head_commit.message }}* | |
# branch: action-format | |
# delete-branch: true |