Skip to content
This repository has been archived by the owner on Sep 28, 2024. It is now read-only.

Update latest user agents #223

Update latest user agents

Update latest user agents #223

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@v3
with:
fetch-depth: 0
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Check cache
uses: actions/cache@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@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