Skip to content

Update latest user agents #20

Update latest user agents

Update latest user agents #20

Workflow file for this run

name: Update latest user agents
on:
push:
branches:
- main
schedule:
- cron: '0 0 * * MON'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
build:
name: Update latest user agents
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@1a4442cacd436585916779262731d5b162bc6ec7 # v3
with:
node-version: 18
- name: Check cache
uses: actions/cache@e12d46a63a90f2fae62d114769bbf2a179198b5c # v3
id: npm-cache
with:
path: '**/node_modules'
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
- name: Install dependencies
if: steps.npm-cache.outputs.cache-hit != 'true'
run: npm install
- name: Scrape user agents
run: npm run start
- name: Checkout gh-pages branch
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 # v3
with:
ref: gh-pages
path: gh-pages
- name: Move build files to repo folder
run: rsync -a --delete --exclude .git --exclude .nojekyll --exclude index.html build/ gh-pages/
- name: Push repo changes
run: |
cd gh-pages
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "github-actions[bot]"
if [ -n "$(git status --porcelain)" ]; then
git add .
git commit -m "Update user agents"
git push
else
echo "No changes to commit"
fi