File tree Expand file tree Collapse file tree 1 file changed +2
-35
lines changed
Expand file tree Collapse file tree 1 file changed +2
-35
lines changed Original file line number Diff line number Diff line change 44 schedule :
55 - cron : ' 0 * * * *'
66 workflow_dispatch :
7+ pull_request :
8+ types : [opened, synchronize, reopened]
79
810permissions :
911 contents : write
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
You can’t perform that action at this time.
0 commit comments