minor cleanup
This commit is contained in:
parent
65d0f7317c
commit
ce01945e6e
2 changed files with 0 additions and 116 deletions
69
.github/workflows/autoupdate.yml
vendored
69
.github/workflows/autoupdate.yml
vendored
|
|
@ -1,69 +0,0 @@
|
|||
name: clean | Auto Update Dependencies
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * 1' # Run every Monday at midnight
|
||||
workflow_dispatch: # Allow manual triggering
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
paths:
|
||||
- 'requirements.txt'
|
||||
- 'pyproject.toml'
|
||||
- 'poetry.lock'
|
||||
pull_request:
|
||||
types: [opened, synchronize, reopened]
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
paths:
|
||||
- 'requirements.txt'
|
||||
- 'pyproject.toml'
|
||||
- 'poetry.lock'
|
||||
|
||||
jobs:
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
contents: write
|
||||
pull-requests: write
|
||||
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
token: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }} # Personal Access Token with repo scope
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.12'
|
||||
|
||||
- name: Install Poetry
|
||||
run: |
|
||||
pip install --upgrade pip
|
||||
pip install "poetry>=2.0.0"
|
||||
|
||||
- name: Update dependencies with Poetry
|
||||
run: |
|
||||
poetry update
|
||||
# If you still need a requirements.txt synced from Poetry:
|
||||
poetry export --without-hashes --format requirements.txt --output requirements.txt
|
||||
|
||||
- name: Commit changes
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git add pyproject.toml poetry.lock requirements.txt
|
||||
git diff --quiet && git diff --staged --quiet || git commit -m "chore: update dependencies"
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v6
|
||||
with:
|
||||
token: ${{ secrets.PAT_FOR_CROSS_REPOS_CICD_TRIGGERING }} # Personal Access Token with repo scope
|
||||
commit-message: "chore: update dependencies"
|
||||
title: "chore: update dependencies"
|
||||
body: "Automated dependency updates via Poetry"
|
||||
branch: "chore/dependency-updates"
|
||||
delete-branch: true
|
||||
47
.github/workflows/clean_old_git_actions.yml
vendored
47
.github/workflows/clean_old_git_actions.yml
vendored
|
|
@ -1,47 +0,0 @@
|
|||
name: clean | Cleanup Old Workflow Runs
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 3 * * 0' # Runs every Sunday at 03:00 UTC
|
||||
workflow_dispatch: # Allows manual trigger
|
||||
|
||||
jobs:
|
||||
cleanup:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Delete old workflow runs
|
||||
env:
|
||||
GH_PAT: ${{ secrets.GH_PAT }}
|
||||
REPO: ${{ github.repository }}
|
||||
DAYS: 100 # Adjust the number of days if needed
|
||||
run: |
|
||||
# Get current timestamp
|
||||
NOW=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
||||
|
||||
# Fetch all workflow runs
|
||||
runs=$(curl -s -H "Authorization: token $GH_PAT" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
"https://api.github.com/repos/$REPO/actions/runs" | jq -c '.workflow_runs[]')
|
||||
|
||||
# Loop through each run
|
||||
echo "$runs" | while read -r run; do
|
||||
created_at=$(echo "$run" | jq -r '.created_at')
|
||||
run_id=$(echo "$run" | jq -r '.id')
|
||||
|
||||
# Convert timestamps to seconds
|
||||
created_seconds=$(date -d "$created_at" +%s)
|
||||
now_seconds=$(date -d "$NOW" +%s)
|
||||
|
||||
# Calculate age of workflow run
|
||||
age_days=$(( (now_seconds - created_seconds) / 86400 ))
|
||||
|
||||
if [ "$age_days" -gt "$DAYS" ]; then
|
||||
echo "Deleting workflow run ID: $run_id (Created: $created_at, Age: $age_days days)"
|
||||
curl -X DELETE -H "Authorization: token $GH_PAT" \
|
||||
-H "Accept: application/vnd.github.v3+json" \
|
||||
"https://api.github.com/repos/$REPO/actions/runs/$run_id"
|
||||
else
|
||||
echo "Skipping workflow run ID: $run_id (Created: $created_at, Age: $age_days days)"
|
||||
fi
|
||||
done
|
||||
Loading…
Add table
Reference in a new issue