Update deploy scripts to create a PR

This commit is contained in:
Deco Vander 2025-07-03 22:53:53 -04:00
parent d19cd2766c
commit d766f08338

View file

@ -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 }}