Skip to content

Instantly share code, notes, and snippets.

@RussellDash332
Created July 28, 2021 16:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RussellDash332/6463c174e6934f791e49457840652b64 to your computer and use it in GitHub Desktop.
Save RussellDash332/6463c174e6934f791e49457840652b64 to your computer and use it in GitHub Desktop.
main.yaml for my first Medium post
name: Autobuild README
on:
push:
branches:
- main
schedule:
# README updates every new hour
# Use '0 */1 * * *' or '@hourly'
- cron: '0 */1 * * *'
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout current repository to main branch
uses: actions/checkout@v2.3.4
- name: Setup Node.js 13.x
uses: actions/setup-node@v2.3.0
with:
node-version: '13.x'
- name: Cache dependencies and build outputs
uses: actions/cache@v2.1.6
with:
path: node_modules
key: ${{ runner.os }}-js-${{ hashFiles('package-lock.json') }}
- name: Install dependencies
run: npm install
- name: Generate README file
run: node index.js
env:
OPEN_WEATHER_MAP_KEY: ${{secrets.OPEN_WEATHER_MAP_KEY}}
- name: Commit and push new README.md
run: |-
git diff
git config --global user.email "${{secrets.GLOBAL_USER_EMAIL}}"
git config --global user.name "${{secrets.GLOBAL_USER_NAME}}"
git commit -a -m "Hourly content update" || exit 0
git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment