forked from timdown/rangy
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from brainly/auto-sync
Add GitHub Actions workflow to sync fork with upstream repository
- Loading branch information
Showing
1 changed file
with
53 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Sync Fork with Upstream and Request Review | ||
|
||
on: | ||
schedule: | ||
- cron: '0 2 * * *' # Runs daily at 2:00 AM UTC | ||
workflow_dispatch: # Allows manual trigger | ||
|
||
permissions: | ||
contents: write # Required to push changes and create pull requests | ||
|
||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
# Step 1: Checkout the forked repository | ||
- name: Checkout Fork | ||
uses: actions/checkout@v3 | ||
|
||
# Step 2: Fetch updates from the upstream repository | ||
- name: Fetch Upstream | ||
run: | | ||
git remote add upstream https://github.com/timdown/rangy.git | ||
git fetch upstream | ||
git checkout main | ||
git merge upstream/main --no-commit --no-ff | ||
# Step 3: Create a new branch with the updates | ||
- name: Create Sync Branch | ||
run: | | ||
git checkout -b sync-upstream-$(date +%Y%m%d%H%M%S) | ||
git add . | ||
git commit -m "Sync with upstream changes" | ||
# Step 4: Push the new branch to your fork | ||
- name: Push Changes to New Branch | ||
run: | | ||
git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} HEAD | ||
# Step 5: Create a pull request and request a review | ||
- name: Create Pull Request | ||
uses: peter-evans/create-pull-request@v5 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
commit-message: "Sync with upstream" | ||
branch: sync-upstream-$(date +%Y%m%d%H%M%S) | ||
base: main | ||
title: "Sync with upstream changes" | ||
body: | | ||
This PR syncs the forked repository with the latest changes from the upstream repository (timdown/rangy). | ||
Please review and merge if everything looks good. | ||
reviewers: brainly/frontend-infra |