daily-update #92338
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: daily-update | |
on: | |
push: | |
schedule: | |
- cron: "*/3 * * * *" | |
permissions: | |
contents: write | |
jobs: | |
hackernews-daily: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
ref: main | |
- name: Use Node.js | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 12.x | |
- name: npm install | |
run: npm install --only=prod | |
working-directory: . | |
- name: Get fresh HackerNews | |
run: node ./feeds/hackernews-daily/index.js | |
# you need git commit to push the forks data to the repo | |
- name: Git commit | |
run: | | |
# git commit if there's any change | |
if test -n "$(git status --porcelain 2>/dev/null)"; then | |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git add . | |
git commit -m "Update Hacker News daily top data" | |
git pull | |
git push origin main | |
fi |