Skip to content

Fetch GogoAnime Current Domain #22

Fetch GogoAnime Current Domain

Fetch GogoAnime Current Domain #22

name: Fetch GogoAnime Current Domain
on:
schedule:
- cron: '0 0 * * 0' # Runs every Sunday at midnight
workflow_dispatch: # Allows manual triggering
jobs:
fetch-url:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Fetch URL and extract link
id: fetch_url
run: |
sudo apt-get update && sudo apt-get install -y libxml2-utils
response=$(curl -s https://gogotaku.info/)
url=$(echo "$response" | xmllint --html --xpath 'string(//span[@class="site_go"][1])' - 2>/dev/null)
echo "current_url=https://$url" >> $GITHUB_ENV
- name: Write URL to CURRENT_URL.txt
run: echo "${{ env.current_url }}" > CURRENT_URL.txt
- name: Check for changes
id: check_changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add CURRENT_URL.txt
if git diff-index --quiet HEAD --; then
echo "changes=false" >> $GITHUB_ENV
else
echo "changes=true" >> $GITHUB_ENV
fi
- name: Commit changes
if: env.changes == 'true'
run: |
git commit -m 'chore: update gogoanime url'
git push
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}