Auto PR for Site Package Changes #1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto PR for Site Package Changes | |
on: | |
# Schedule to run daily at 2:00 AM UTC | |
schedule: | |
- cron: '0 2 * * *' | |
# Manual trigger via "Run workflow" button in GitHub Actions UI | |
workflow_dispatch: | |
jobs: | |
auto-pr: | |
name: Create PR for Site Package Changes | |
runs-on: ubuntu-latest | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
BRANCH_NAME: 'auto/sitepackage-update' | |
COMMIT_MESSAGE: 'Auto-update of site package files' | |
PR_TITLE: 'Automated Update of Site Package Files' | |
PR_BODY: 'This PR contains automatic updates to the site package files generated by the script.' | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Set Up Git | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
- name: Run Generate Site Package Script | |
run: | | |
chmod +x Build/DownloadSitePackage/generate_sitepackage.sh | |
./Build/DownloadSitePackage/generate_sitepackage.sh | |
- name: Check for Changes | |
run: | | |
if git diff --quiet; then | |
echo "No changes detected, skipping PR creation." | |
exit 0 | |
fi | |
- name: Create Branch | |
run: | | |
git checkout -b ${{ env.BRANCH_NAME }} | |
git add . | |
git commit -m "${{ env.COMMIT_MESSAGE }}" | |
- name: Push Changes to New Branch | |
run: | | |
git push --force --set-upstream origin ${{ env.BRANCH_NAME }} | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
branch: ${{ env.BRANCH_NAME }} | |
title: ${{ env.PR_TITLE }} | |
body: ${{ env.PR_BODY }} |