List of repos that contain SparkFun Getting Started Guides #522
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: List of repos that contain SparkFun Getting Started Guides | |
on: | |
push: | |
branches: | |
- "main" | |
workflow_dispatch: | |
branches: | |
schedule: | |
# Daily at 8:20 UTC | |
- cron: '20 8 * * *' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | |
jobs: | |
# This workflow contains a single job called "build" | |
build-gsg-repos: | |
# The type of runner that the job will run on | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v3 | |
# Run our gh command to find repos - only finds public repos with the given tag | |
- name: gh command | |
uses: nick-fields/retry@v3 | |
with: | |
command: gh search repos topic:sparkfun-tutorial --owner sparkfun --visibility public --sort updated --order desc --limit 1000 --json name,url,homepage,description > gsg.json | |
max_attempts: 3 | |
retry_wait_seconds: 180 | |
timeout_minutes: 2 | |
- name: Check for updates | |
id: has_updates | |
run: | | |
git config --global user.name 'SparkFun Automated Action' | |
git config --global user.email '[email protected]' | |
git diff --exit-code gsg.json | |
continue-on-error: true | |
- name: Check-in gsg updates | |
if: steps.has_updates.outcome != 'success' | |
run: | | |
git add gsg.json | |
git commit -m "daily update" | |
git push | |