Fetch GitHub Repos #46
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: Fetch GitHub Repos | |
on: | |
schedule: | |
# Every sunday at 00:00 | |
- cron: '0 0 * * 0' | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
jobs: | |
fetch_repos: | |
name: Update Repos Data | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
- name: Fetch Repos Data | |
env: | |
GH_TOKEN: ${{ secrets.HUGO_SITE_GIT_TOKEN }} | |
run: | | |
gh api \ | |
--header 'Accept: application/vnd.github+json' \ | |
--method GET users/zamb0/repos \ | |
--include | grep 200 | |
if [ $? -eq 0 ]; then | |
gh api \ | |
--header 'Accept: application/vnd.github+json' \ | |
--method GET users/zamb0/repos > data/repos.json | |
else | |
echo "Failed to fetch profile data" | |
exit 1 | |
fi | |
gh api \ | |
--header 'Accept: application/vnd.github+json' \ | |
--method GET repos/TeoScardov/cloud-project-2024 \ | |
--include | grep 200 | |
if [ $? -eq 0 ]; then | |
gh api \ | |
--header 'Accept: application/vnd.github+json' \ | |
--method GET repos/TeoScardov/cloud-project-2024 > data/manual.json | |
else | |
echo "Failed to fetch mono repo" | |
exit 1 | |
fi | |
- name: Update resources | |
uses: test-room-7/[email protected] | |
with: | |
file-path: | | |
data/repos.json | |
data/manual.json | |
commit-msg: Update data | |
github-token: ${{ secrets.HUGO_SITE_GIT_TOKEN }} | |