File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -18,10 +18,24 @@ jobs:
1818 run : |
1919 curl -sS -o /tmp/remote_ads.txt "https://monu.delivery/adstxt/e/4/500442-526a-41af-9981-22db9286cd37.txt"
2020
21- - name : Compare and update ads.txt if needed
21+ - name : Remove comments and process ads.txt
2222 run : |
23- if ! cmp -s /tmp/remote_ads.txt static/ads.txt; then
24- mv /tmp/remote_ads.txt static/ads.txt
23+ # Create a cleaned version with comments removed
24+ grep -v "^#" /tmp/remote_ads.txt > /tmp/cleaned_ads.txt
25+
26+ # Compare the cleaned file with existing ads.txt
27+ if [ -f static/ads.txt ]; then
28+ # Create a cleaned version of the existing file for comparison
29+ grep -v "^#" static/ads.txt > /tmp/existing_cleaned.txt
30+
31+ if ! cmp -s /tmp/cleaned_ads.txt /tmp/existing_cleaned.txt; then
32+ # Only copy the cleaned version (without comments)
33+ cp /tmp/cleaned_ads.txt static/ads.txt
34+ echo "UPDATED=true" >> $GITHUB_ENV
35+ fi
36+ else
37+ # If ads.txt doesn't exist yet, create it from the cleaned version
38+ cp /tmp/cleaned_ads.txt static/ads.txt
2539 echo "UPDATED=true" >> $GITHUB_ENV
2640 fi
2741
3246 git config --global user.email "github-actions[bot]@users.noreply.github.com"
3347 git add static/ads.txt
3448 git commit -m "update ads.txt"
35- git push https://x-access-token:${{ secrets.GH_PAT }}@github.com/${{ github.repository }}.git main
49+ git push https://x-access-token:${{ secrets.GH_PAT }}@github.com/${{ github.repository }}.git main
You can’t perform that action at this time.
0 commit comments