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
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 * * * *' # Runs every hour
|
||||
workflow_dispatch:
|
||||
- cron: '0 * * * *'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: python:3.9-slim
|
||||
runs-on: ubuntu-latest # This now points to the 'catthehacker' image
|
||||
steps:
|
||||
- name: Manual Git Clone
|
||||
run: |
|
||||
# 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
|
||||
git clone http://your-gitea-ip:3000/${{ gitea.repository }}.git .
|
||||
|
||||
- name: Run Script
|
||||
run: |
|
||||
pip3 install requests --break-system-packages
|
||||
python3 update_profile.py
|
||||
- name: Checkout Code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Install Requirements
|
||||
run: pip3 install requests --break-system-packages
|
||||
|
||||
- name: Run Update Script
|
||||
env:
|
||||
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
|
||||
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