Skip to content
This repository has been archived by the owner on Feb 25, 2025. It is now read-only.

Commit

Permalink
Update action to sync upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
ghostwriternr committed Apr 15, 2024
1 parent a22a28e commit 4f94c5d
Showing 1 changed file with 25 additions and 19 deletions.
44 changes: 25 additions & 19 deletions .github/workflows/sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,46 @@ on:
- cron: "0 8 * * *" # Runs every day at 8 AM GMT
workflow_dispatch:

permissions:
contents: write
pull-requests: write

jobs:
update_fork:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.BINARIES_RELEASE_PAT }}

- name: Configure Git
- name: Get current date
id: current_date
run: |
git config --global user.email "[email protected]"
git config --global user.name "GitHub Actions"
echo "date=$(date +'%d%m%y')" >> $GITHUB_OUTPUT
echo "time=$(date +'%d%m%y %H:%M')" >> $GITHUB_OUTPUT
- name: Add upstream remote
- name: Configure git
env:
GITHUB_USERNAME: ${{ github.repository_owner }}
run: |
git remote add upstream https://github.com/microsoft/vscode.git
git config --global user.email "$( echo "${GITHUB_USERNAME}" | awk '{print tolower($0)}' )[email protected]"
git config --global user.name "${GITHUB_USERNAME} CI"
- name: Fetch upstream changes
continue-on-error: true
run: |
git remote add upstream https://github.com/microsoft/vscode.git
git fetch upstream
- name: Merge upstream changes
run: |
git checkout -b update-from-upstream
git merge upstream/main
- name: Push changes to fork
run: |
git push -u origin update-from-upstream
git merge upstream/main || true
git add -A
- name: Create pull request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create --base main --head update-from-upstream --title "Update from upstream" --body "This pull request updates the fork with the latest changes from the upstream repository."
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.BINARIES_RELEASE_PAT }}
commit-message: Fetch upstream ${{ steps.current_date.outputs.time }}
branch: fetch-upstream-${{ steps.current_date.outputs.date }}
title: Fetch upstream ${{ steps.current_date.outputs.date }}

0 comments on commit 4f94c5d

Please sign in to comment.