diff --git a/.github/workflows/deploy-scripts.yml b/.github/workflows/deploy-scripts.yml index 95ad2e7..86423e9 100644 --- a/.github/workflows/deploy-scripts.yml +++ b/.github/workflows/deploy-scripts.yml @@ -10,7 +10,8 @@ on: permissions: id-token: write - contents: read + contents: write + pull-requests: write jobs: deploy-scripts: @@ -59,9 +60,54 @@ jobs: echo "No README updates needed" else echo "README updated with new S3 URLs" - git config --local user.email "action@github.com" - git config --local user.name "GitHub Action" - git add README.md - git commit -m "Update deployment URLs [skip ci]" - git push + + # Get current branch name + CURRENT_BRANCH=$(git rev-parse --abbrev-ref HEAD) + echo "Current branch: $CURRENT_BRANCH" + + if [[ "$CURRENT_BRANCH" == "main" ]]; then + echo "On main branch - creating PR instead of direct commit" + + # Create a new branch for the update + BRANCH_NAME="update-readme-urls-$(date +%Y%m%d-%H%M%S)" + git checkout -b "$BRANCH_NAME" + + # Configure git and commit changes + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add README.md + git commit -m "Update deployment URLs + + - Updated S3 URLs in README.md + - Deploy script URL: https://${{ secrets.S3_BUCKET_NAME }}.s3.amazonaws.com/scripts/deploy.sh" + + # Push the new branch + git push origin "$BRANCH_NAME" + + # Create PR using GitHub CLI + gh pr create \ + --title "Update deployment URLs in README" \ + --body "🤖 **Automated update from deployment workflow** + + This PR updates the deployment URLs in README.md with the current S3 bucket URLs. + + **Changes:** + - Updated deploy script URL to: https://${{ secrets.S3_BUCKET_NAME }}.s3.amazonaws.com/scripts/deploy.sh + + **Generated by:** ${{ github.workflow }} workflow + **Commit:** ${{ github.sha }}" \ + --head "$BRANCH_NAME" \ + --base "main" + + echo "✅ PR created successfully!" + else + echo "Not on main branch - committing directly" + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add README.md + git commit -m "Update deployment URLs [skip ci]" + git push + fi fi + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index dff7b64..e6d0a9e 100644 --- a/README.md +++ b/README.md @@ -65,7 +65,7 @@ PORT=3000 1. **Run the deployment script on your server:** ```bash - curl -sSL https://ice.puremichigan.lol/scripts/deploy.sh | bash + curl -sSL https://ice-puremichigan-lol.s3.amazonaws.com/scripts/deploy.sh | bash ``` 2. **Deploy your application:** diff --git a/public/index.html b/public/index.html index fb5eef8..5c9fec2 100644 --- a/public/index.html +++ b/public/index.html @@ -15,7 +15,7 @@

❄️ Great Lakes Ice Report

-

Community-reported icy road conditions and winter hazards (auto-expire after 48 hours)

+

Community-reported ICEy road conditions and winter hazards (auto-expire after 48 hours)