Skip to content

Commit

Permalink
tmp test ephemeral shell script
Browse files Browse the repository at this point in the history
  • Loading branch information
lukqw committed Dec 3, 2024
1 parent cb18c73 commit 732adf3
Showing 1 changed file with 2 additions and 35 deletions.
37 changes: 2 additions & 35 deletions .github/workflows/ephemeral.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ on:
schedule:
- cron: '0 * * * *'
workflow_dispatch:
pull_request:
types: [opened, synchronize, reopened]

permissions:
contents: write
Expand Down Expand Up @@ -55,38 +57,3 @@ jobs:
echo "NEW_URL=$NEW_URL" >> $GITHUB_ENV
env:
LOCALSTACK_AUTH_TOKEN: ${{ secrets.LOCALSTACK_AUTH_TOKEN }}

- name: Generate index.html with New Redirect URL
run: |
NEW_URL="${{ env.NEW_URL }}"
# Validate the URL
if [[ ! "$NEW_URL" =~ ^https?:// ]]; then
echo "Error: Invalid URL provided."
exit 1
fi
echo "Redirecting to: $NEW_URL"
cat > index.html <<EOL
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="refresh" content="0; URL=${NEW_URL}">
<title>Redirecting...</title>
</head>
<body>
<p>If you are not redirected automatically, follow this <a href="${NEW_URL}">link</a>.</p>
</body>
</html>
EOL
- name: Switch to gh-pages Branch and Commit Changes
run: |
git fetch origin gh-pages || echo "gh-pages branch does not exist; creating it."
git checkout gh-pages || git checkout --orphan gh-pages
git rm -rf . # Remove all files in the branch
git add index.html
git commit -m "Update redirect to ${NEW_URL}"
git push origin gh-pages --force

0 comments on commit 732adf3

Please sign in to comment.