Skip to content

Commit 732adf3

Browse files
committed
tmp test ephemeral shell script
1 parent cb18c73 commit 732adf3

File tree

1 file changed

+2
-35
lines changed

1 file changed

+2
-35
lines changed

.github/workflows/ephemeral.yml

Lines changed: 2 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ on:
44
schedule:
55
- cron: '0 * * * *'
66
workflow_dispatch:
7+
pull_request:
8+
types: [opened, synchronize, reopened]
79

810
permissions:
911
contents: write
@@ -55,38 +57,3 @@ jobs:
5557
echo "NEW_URL=$NEW_URL" >> $GITHUB_ENV
5658
env:
5759
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}
58-
59-
- name: Generate index.html with New Redirect URL
60-
run: |
61-
NEW_URL="${{ env.NEW_URL }}"
62-
63-
# Validate the URL
64-
if [[ ! "$NEW_URL" =~ ^https?:// ]]; then
65-
echo "Error: Invalid URL provided."
66-
exit 1
67-
fi
68-
69-
echo "Redirecting to: $NEW_URL"
70-
71-
cat > index.html <<EOL
72-
<!DOCTYPE html>
73-
<html lang="en">
74-
<head>
75-
<meta charset="UTF-8">
76-
<meta http-equiv="refresh" content="0; URL=${NEW_URL}">
77-
<title>Redirecting...</title>
78-
</head>
79-
<body>
80-
<p>If you are not redirected automatically, follow this <a href="${NEW_URL}">link</a>.</p>
81-
</body>
82-
</html>
83-
EOL
84-
85-
- name: Switch to gh-pages Branch and Commit Changes
86-
run: |
87-
git fetch origin gh-pages || echo "gh-pages branch does not exist; creating it."
88-
git checkout gh-pages || git checkout --orphan gh-pages
89-
git rm -rf . # Remove all files in the branch
90-
git add index.html
91-
git commit -m "Update redirect to ${NEW_URL}"
92-
git push origin gh-pages --force

0 commit comments

Comments
 (0)