mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
fix(ci): update indexers workflow with improved path handling (#1874)
* fix(ci): update indexers workflow with improved path handling
This commit is contained in:
parent
81ce8acb2b
commit
66fa645625
2 changed files with 49 additions and 14 deletions
55
.github/workflows/update-indexers.yml
vendored
55
.github/workflows/update-indexers.yml
vendored
|
@ -7,6 +7,12 @@ on:
|
||||||
repository_dispatch:
|
repository_dispatch:
|
||||||
types: [update-indexers]
|
types: [update-indexers]
|
||||||
|
|
||||||
|
env:
|
||||||
|
DOCS_REPO: 'autobrr/autobrr.com'
|
||||||
|
SOURCE_REPO: 'autobrr/autobrr'
|
||||||
|
DOCS_PATH: 'autobrr.com'
|
||||||
|
SOURCE_PATH: 'autobrr'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-indexers:
|
update-indexers:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
@ -15,15 +21,15 @@ jobs:
|
||||||
- name: Check out autobrr.com repo
|
- name: Check out autobrr.com repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: 'autobrr/autobrr.com'
|
repository: ${{ env.DOCS_REPO }}
|
||||||
path: 'autobrr.com'
|
path: ${{ env.DOCS_PATH }}
|
||||||
token: ${{ secrets.DOCS_TOKEN }}
|
token: ${{ secrets.DOCS_TOKEN }}
|
||||||
|
|
||||||
- name: Check out autobrr repo
|
- name: Check out autobrr repo
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
repository: 'autobrr/autobrr'
|
repository: ${{ env.SOURCE_REPO }}
|
||||||
path: 'autobrr'
|
path: ${{ env.SOURCE_PATH }}
|
||||||
|
|
||||||
- name: Set up Python
|
- name: Set up Python
|
||||||
uses: actions/setup-python@v4
|
uses: actions/setup-python@v4
|
||||||
|
@ -31,29 +37,58 @@ jobs:
|
||||||
python-version: '3.x'
|
python-version: '3.x'
|
||||||
|
|
||||||
- name: Update indexers list
|
- name: Update indexers list
|
||||||
run: python3 autobrr/scripts/update-indexers.py
|
run: |
|
||||||
|
# Verify source paths exist before running script
|
||||||
|
if [ ! -d "${{ env.SOURCE_PATH }}/internal/indexer/definitions" ]; then
|
||||||
|
echo "Error: Required definitions directory not found"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Running update script..."
|
||||||
|
cd ${{ env.SOURCE_PATH }}
|
||||||
|
python3 scripts/update-indexers.py
|
||||||
|
echo "Update script completed"
|
||||||
|
|
||||||
|
# Verify output files were generated
|
||||||
|
echo "Checking generated files..."
|
||||||
|
ls -l ../${{ env.DOCS_PATH }}/snippets/indexers.mdx ../${{ env.DOCS_PATH }}/snippets/freeleech.mdx || true
|
||||||
|
|
||||||
- name: Create Pull Request
|
- name: Create Pull Request
|
||||||
run: |
|
run: |
|
||||||
cd autobrr.com
|
cd ${{ env.DOCS_PATH }}
|
||||||
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
git config --local user.email "github-actions[bot]@users.noreply.github.com"
|
||||||
git config --local user.name "github-actions[bot]"
|
git config --local user.name "github-actions[bot]"
|
||||||
|
|
||||||
|
echo "Current git status:"
|
||||||
|
git status
|
||||||
|
|
||||||
# Create a new branch
|
# Create a new branch
|
||||||
BRANCH_NAME="update-indexers-$(date +%Y%m%d-%H%M%S)"
|
BRANCH_NAME="update-indexers-$(date +%Y%m%d-%H%M%S)"
|
||||||
|
echo "Creating branch: $BRANCH_NAME"
|
||||||
git checkout -b $BRANCH_NAME
|
git checkout -b $BRANCH_NAME
|
||||||
|
|
||||||
|
echo "Changes to be added:"
|
||||||
|
git status snippets/indexers.mdx snippets/freeleech.mdx
|
||||||
|
|
||||||
# Add and commit changes
|
# Add and commit changes
|
||||||
git add snippets/indexers.mdx snippets/freeleech.mdx
|
git add snippets/indexers.mdx snippets/freeleech.mdx
|
||||||
|
|
||||||
# Only proceed if there are changes
|
echo "Git status after adding files:"
|
||||||
if ! git diff --quiet && ! git diff --staged --quiet; then
|
git status
|
||||||
|
|
||||||
|
# Check if there are staged changes
|
||||||
|
if git diff --cached --quiet; then
|
||||||
|
echo "No changes detected in the files"
|
||||||
|
else
|
||||||
|
echo "Changes detected, creating commit and PR"
|
||||||
git commit -m "docs: update indexers and freeleech support lists"
|
git commit -m "docs: update indexers and freeleech support lists"
|
||||||
|
|
||||||
|
echo "Pushing changes..."
|
||||||
git push origin $BRANCH_NAME
|
git push origin $BRANCH_NAME
|
||||||
|
|
||||||
# Create PR using GitHub CLI
|
echo "Creating PR..."
|
||||||
gh pr create \
|
gh pr create \
|
||||||
--repo autobrr/autobrr.com \
|
--repo ${{ env.DOCS_REPO }} \
|
||||||
--base main \
|
--base main \
|
||||||
--head $BRANCH_NAME \
|
--head $BRANCH_NAME \
|
||||||
--title "docs: update indexers and freeleech support lists" \
|
--title "docs: update indexers and freeleech support lists" \
|
||||||
|
|
|
@ -5,9 +5,9 @@ import re
|
||||||
from typing import Dict
|
from typing import Dict
|
||||||
|
|
||||||
# Paths relative to GitHub Actions workspace
|
# Paths relative to GitHub Actions workspace
|
||||||
DEFINITIONS_DIR = "autobrr/internal/indexer/definitions"
|
DEFINITIONS_DIR = "../autobrr/internal/indexer/definitions"
|
||||||
INDEXERS_OUTPUT = "autobrr.com/snippets/indexers.mdx"
|
INDEXERS_OUTPUT = "../autobrr.com/snippets/indexers.mdx"
|
||||||
FREELEECH_OUTPUT = "autobrr.com/snippets/freeleech.mdx"
|
FREELEECH_OUTPUT = "../autobrr.com/snippets/freeleech.mdx"
|
||||||
|
|
||||||
def parse_yaml_file(file_path: str) -> Dict:
|
def parse_yaml_file(file_path: str) -> Dict:
|
||||||
"""Parse YAML files"""
|
"""Parse YAML files"""
|
||||||
|
@ -105,4 +105,4 @@ def main():
|
||||||
f.write(content)
|
f.write(content)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
main()
|
main()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue