Skip to content

Commit 6745913

Browse files
committed
ci: just use curl
1 parent b29b5d0 commit 6745913

File tree

1 file changed

+22
-18
lines changed

1 file changed

+22
-18
lines changed

.github/workflows/archive-new-urls.yml

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -28,31 +28,35 @@ jobs:
2828
env:
2929
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3030

31-
- name: Extract new URLs from diff and archive
31+
- name: Extract and archive URLs
3232
id: url-check
3333
run: |
34-
# Extract URLs and set up multiline output
34+
# Extract URLs
3535
URLS=$(git diff ${{ steps.last-run.outputs.sha }} -- _data/conferences.yml | \
3636
grep -E '^\+.*https?://[^ ]+' | \
3737
sed -E 's/^\+[[:space:]]*[^:]*:[[:space:]]*(https?:\/\/[^ ]+).*/\1/')
3838
3939
if [ -n "$URLS" ]; then
40-
echo "has_new_urls=true" >> $GITHUB_OUTPUT
41-
{
42-
echo "urls<<EOF"
43-
echo "$URLS"
44-
echo "EOF"
45-
} >> $GITHUB_OUTPUT
46-
echo "Found new URLs:"
47-
echo "$URLS"
40+
echo "Found new URLs, archiving to Wayback Machine..."
41+
42+
# Process each URL
43+
echo "$URLS" | while read -r url; do
44+
echo "Archiving: $url"
45+
# Call Wayback Machine Save API
46+
response=$(curl -s -L -X POST \
47+
-A "Python-Deadlines-Bot/1.0 (https://pythondeadlin.es; [email protected])" \
48+
"https://web.archive.org/save/$url")
49+
status=$?
50+
51+
if [ $status -eq 0 ]; then
52+
echo "✓ Successfully archived"
53+
else
54+
echo "⚠ Failed to archive (error $status)"
55+
fi
56+
57+
# Wait between requests
58+
sleep 5
59+
done
4860
else
49-
echo "has_new_urls=false" >> $GITHUB_OUTPUT
5061
echo "No new URLs found"
5162
fi
52-
53-
- name: Archive new URLs in Wayback Machine
54-
if: steps.url-check.outputs.has_new_urls == 'true'
55-
uses: JamieMagee/[email protected]
56-
with:
57-
url: |-
58-
${{ steps.url-check.outputs.urls }}

0 commit comments

Comments
 (0)