Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure sync with upstream action #4

Open
wants to merge 28 commits into
base: atleta
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
38eec63
Remove unrelated jobs
ales-tsurko May 2, 2024
88f1870
Configure upstream sync
ales-tsurko May 2, 2024
9e191c4
Add write permission to the sync workflow
ales-tsurko Aug 12, 2024
3566234
Uptate GH_TOKEN. Create Pull Reques from workflow
semeniak97mf Aug 20, 2024
4de7ab4
Grant all permissions for default GH_TOKEN
semeniak97mf Aug 21, 2024
8f6670a
Reduce permissions for GH_TOKEN. Edit PR structure
semeniak97mf Aug 21, 2024
609e301
Correct Actions URL
semeniak97mf Aug 21, 2024
b6877af
Check if PR already exists
semeniak97mf Aug 21, 2024
7b71fcf
Check if PR already exists fix 1
semeniak97mf Aug 21, 2024
8ad432a
Check if PR already exists fix 2
semeniak97mf Aug 21, 2024
64473fd
Change sync branch from action to bash commands
semeniak97mf Aug 22, 2024
c5f2333
Add GH_account
semeniak97mf Aug 22, 2024
de3e5c4
Check if there are new commits to sync
semeniak97mf Aug 22, 2024
1875ff9
Check if there are new commits to sync fix 1
semeniak97mf Aug 22, 2024
4015119
Check if there are new commits to sync fix 2
semeniak97mf Aug 22, 2024
ed2b958
Check if there are new commits to sync fix 3
semeniak97mf Aug 22, 2024
2ab70c6
Check if there are new commits to sync fix 4
semeniak97mf Aug 22, 2024
2c1115d
Check if there are new commits to sync fix 5
semeniak97mf Aug 23, 2024
7b7cd47
Check if there are new commits to sync fix 6
semeniak97mf Aug 23, 2024
3fc1d6b
Check if there are new commits to sync fix 7
semeniak97mf Aug 23, 2024
f36d270
Check if there are new commits to sync fix 8
semeniak97mf Aug 23, 2024
d87d6dc
Check if there are new commits to sync fix 9
semeniak97mf Aug 23, 2024
b4f3531
Check if there are new commits to sync fix 10
semeniak97mf Aug 23, 2024
2182e0c
Check if there are new commits to sync fix 11
semeniak97mf Aug 23, 2024
67a3345
Check if there are new commits to sync fix 11
semeniak97mf Aug 23, 2024
ab5d725
Check if there are new commits to sync fix 12
semeniak97mf Aug 23, 2024
88ebd73
Check if there are new commits to sync fix 13
semeniak97mf Aug 23, 2024
b7fae7d
Revert to actions in upstream
semeniak97mf Aug 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .github/chain-endpoints.md

This file was deleted.

86 changes: 0 additions & 86 deletions .github/issue_template.md

This file was deleted.

62 changes: 62 additions & 0 deletions .github/workflows/sync-upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: 'Upstream Sync'

permissions:
contents: write
actions: write
pull-requests: write

on:
pull_request:

schedule:
- cron: '0 7 * * 1'
# scheduled at 07:00 every Monday

workflow_dispatch:

jobs:
sync_latest_from_upstream:
runs-on: ubuntu-latest
name: Sync latest commits from upstream repo

steps:
- name: Checkout target repo
uses: actions/checkout@v4
with:
ref: upstream
token: ${{ github.token }}

- name: Sync upstream changes
id: sync
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: Output sync status
run: |
echo "Commits to sync: ${{ steps.sync.outputs.has_new_commits }}"

- name: Check if PR already exists
if: steps.sync.outputs.has_new_commits == 'true'
id: check_pr_exists
env:
GH_TOKEN: ${{ github.token }}
run: |
pr_count=$(gh pr list --repo ${{ github.repository }} --json 'headRefName' --jq 'map(select(.headRefName == "upstream")) | length')
echo "pr_count=${pr_count}" >> $GITHUB_ENV
if [ "$pr_count" -gt 0 ]; then
echo "Pull Request already exists."
else
echo "Pull Request not found. It will be created"
fi

- name: Create Pull Request
if: steps.sync.outputs.has_new_commits == 'true' && env.pr_count == '0'
env:
GH_TOKEN: ${{ github.token }}
run: |
WORKFLOW_URL="https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
gh pr create --repo ${{ github.repository }} --title "Upstream Sync" --body "[View Workflow Run](${WORKFLOW_URL})" --head upstream --base test-auto-pr --reviewer ${{ secrets.REVIEWER_1 }}
Loading