Update monkeytype badges json list #1125
This file contains hidden or 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: Update monkeytype badges json list | |
on: | |
schedule: | |
- cron: "0 */24 * * *" | |
workflow_dispatch: | |
jobs: | |
make-request: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v5 | |
- name: Set up Node.js | |
uses: actions/setup-node@v5 | |
with: | |
node-version: "20.x" | |
- name: Get badge json data from monkeytype | |
run: curl -o monkeytype-data/badges.json https://monkeytype-readme.zeabur.app/mr-command/badge | |
- name: Format code with Prettier | |
run: npx prettier --write ./monkeytype-data/badges.json | |
- name: Print json file contents | |
run: cat monkeytype-data/badges.json | |
- name: Update badge list | |
uses: actions/github-script@v8 | |
with: | |
script: | | |
const fs = require('fs'); | |
let monkeytypeBadgesJson = fs.readFileSync('monkeytype-data/badges.json'); | |
const filePath = '${{ github.workspace }}/monkeytype-data/badges.json'; | |
fs.writeFileSync(filePath, monkeytypeBadgesJson); | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
branch: update-badges-list | |
branch-suffix: timestamp | |
base: master | |
title: "chore: update badges json list" | |
commit-message: "chore: update badges json list" | |
delete-branch: true | |
token: ${{ secrets.GITHUB_TOKEN }} |