Skip to content

Commit

Permalink
Revert to actions in upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
semeniak97mf committed Aug 23, 2024
1 parent 88ebd73 commit b7fae7d
Showing 1 changed file with 13 additions and 41 deletions.
54 changes: 13 additions & 41 deletions .github/workflows/sync-upstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,6 @@ permissions:
contents: write
actions: write
pull-requests: write
attestations: write
checks: write
deployments: write
discussions: write
issues: write
packages: write
pages: write
repository-projects: write
security-events: write
statuses: write

on:
pull_request:
Expand All @@ -23,11 +13,6 @@ on:
# scheduled at 07:00 every Monday

workflow_dispatch:
inputs:
sync_test_mode:
description: 'Fork Sync Test Mode'
type: boolean
default: false

jobs:
sync_latest_from_upstream:
Expand All @@ -39,36 +24,23 @@ jobs:
uses: actions/checkout@v4
with:
ref: upstream
token: ${{ secrets.ACCESS_TOKEN }}
token: ${{ github.token }}

- name: Sync upstream changes
id: sync
run: |
git remote add --fetch upstream https://github.com/polkadot-js/apps.git
git branch -u upstream/master upstream
- name: Check if there are new commits to sync
id: check_commits
run: |
if [ $(git rev-list HEAD...upstream/master --count) -ne 0 ]; then
echo "New commits found"
echo "new_commits=true" >> $GITHUB_ENV
else
echo "This branch is up to date"
echo "new_commits=false" >> $GITHUB_ENV
fi
uses: aormsby/Fork-Sync-With-Upstream-action@v3.4.1
with:
target_sync_branch: upstream
target_repo_token: ${{ github.token }}
upstream_sync_branch: master
upstream_sync_repo: polkadot-js/apps

- name: Push changes to origin
if: env.new_commits == 'true'
env:
GH_TOKEN: ${{ secrets.ACCESS_TOKEN }}
run: |
git pull upstream --ff-only
echo ${{ github.repository }}
git push https://${GH_TOKEN}@github.com/${{ github.repository }} upstream
- name: Output sync status
run: |
echo "Commits to sync: ${{ steps.sync.outputs.has_new_commits }}"
- name: Push changes to origin
if: env.new_commits == 'true'
- name: Check if PR already exists
if: steps.sync.outputs.has_new_commits == 'true'
id: check_pr_exists
env:
GH_TOKEN: ${{ github.token }}
Expand All @@ -82,7 +54,7 @@ jobs:
fi
- name: Create Pull Request
if: env.new_commits == 'true' && env.pr_count == '0'
if: steps.sync.outputs.has_new_commits == 'true' && env.pr_count == '0'
env:
GH_TOKEN: ${{ github.token }}
run: |
Expand Down

0 comments on commit b7fae7d

Please sign in to comment.