Skip to content

Commit

Permalink
update ads.txt workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
holtzy committed Apr 16, 2024
1 parent bfbd3a7 commit d8f6d19
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: 'Update Ads.txt file'

on:
push:
branches:
- '*'

jobs:
update-ads-txt:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3

- name: Fetch ads.txt content
run: |
curl -L https://ads.adthrive.com/sites/6434366c7ccf1c58d32ab68f/ads.txt > static/fetched_ads.txt
if [ $? -eq 0 ]; then
echo "ads.txt fetched successfully."
else
echo "Failed to fetch ads.txt."
exit 1
fi
- name: Compare fetched file with existing ads.txt
id: compare-files
run: |
if cmp -s static/fetched_ads.txt static/ads.txt; then
echo "No changes in ads.txt."
exit 0
else
echo "ads.txt has changed."
mv static/fetched_ads.txt static/ads.txt
fi
- name: Commit and push changes
if: steps.compare-files.outputs.result != 'No changes in ads.txt.'
run: |
if [ "$(git status --porcelain static/ads.txt)" ]; then
git config user.name github-actions
git config user.email [email protected]
git add static/ads.txt
git commit -m "Update ads.txt"
git push
else
echo "No changes to commit."
fi

0 comments on commit d8f6d19

Please sign in to comment.