Skip to content

Commit

Permalink
[TASK] Automatically update site package (#50)
Browse files Browse the repository at this point in the history
Releases: main
  • Loading branch information
linawolf authored Dec 18, 2024
1 parent cdff158 commit 9a3fffa
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions .github/workflows/auto-pr-sitepackage.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
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:
- cron: '0 2 * * *' # Run daily at 2:00 AM UTC
workflow_dispatch: # Manual trigger

jobs:
auto-pr:
Expand All @@ -15,10 +12,10 @@ jobs:

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.'
BASE_BRANCH: 'main' # The branch you want to merge the PR into

steps:
- name: Checkout Repository
Expand All @@ -29,6 +26,11 @@ jobs:
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
- name: Check out the base branch (main)
run: |
git fetch origin ${{ env.BASE_BRANCH }}
git checkout ${{ env.BASE_BRANCH }}
- name: Run Generate Site Package Script
run: |
chmod +x Build/DownloadSitePackage/generate_sitepackage.sh
Expand All @@ -41,20 +43,22 @@ jobs:
exit 0
fi
- name: Create Branch
- name: Create a New Branch for Changes
run: |
git checkout -b ${{ env.BRANCH_NAME }}
NEW_BRANCH="auto/sitepackage-update-$(date +%s)"
git checkout -b $NEW_BRANCH
git add .
git commit -m "${{ env.COMMIT_MESSAGE }}"
- name: Push Changes to New Branch
run: |
git push --force --set-upstream origin ${{ env.BRANCH_NAME }}
git push --force --set-upstream origin $NEW_BRANCH
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
branch: ${{ env.BRANCH_NAME }}
branch: $NEW_BRANCH # Source branch (newly created branch)
base: ${{ env.BASE_BRANCH }} # Target branch (main or production branch)
title: ${{ env.PR_TITLE }}
body: ${{ env.PR_BODY }}

0 comments on commit 9a3fffa

Please sign in to comment.