Refactor update workflow to replace manual git clone with actions/checkout and streamline steps
This commit is contained in:
@@ -1,23 +1,27 @@
|
|||||||
name: Update Profile Stats
|
name: Update Profile Stats
|
||||||
|
|
||||||
on:
|
on:
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '0 * * * *' # Runs every hour
|
- cron: '0 * * * *'
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest # This now points to the 'catthehacker' image
|
||||||
container:
|
|
||||||
image: python:3.9-slim
|
|
||||||
steps:
|
steps:
|
||||||
- name: Manual Git Clone
|
- name: Checkout Code
|
||||||
run: |
|
uses: actions/checkout@v4
|
||||||
# We have to install git first because the runner doesn't even have that!
|
|
||||||
sudo apt-get update && sudo apt-get install -y git python3 python3-pip
|
- name: Install Requirements
|
||||||
git clone http://your-gitea-ip:3000/${{ gitea.repository }}.git .
|
run: pip3 install requests --break-system-packages
|
||||||
|
|
||||||
- name: Run Script
|
- name: Run Update Script
|
||||||
run: |
|
env:
|
||||||
pip3 install requests --break-system-packages
|
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||||
python3 update_profile.py
|
run: python3 update_profile.py
|
||||||
|
|
||||||
|
- name: Commit and Push
|
||||||
|
run: |
|
||||||
|
git config --local user.email "action@gitea.com"
|
||||||
|
git config --local user.name "Gitea Action"
|
||||||
|
git add README.md
|
||||||
|
git diff --quiet && git diff --staged --quiet || (git commit -m "Update profile stats" && git push)
|
||||||
Reference in New Issue
Block a user