Skip to content

Commit 50993be

Browse files
alan-agius4crisbeto
authored andcommitted
ci: add workflow to sync non-default branches (angular#61201)
This workflow addresses a limitation with Renovate's behavior in fork mode. Renovate does not automatically sync non-default branches in forked repositories. This workflow automates syncing forked non-default branches with their upstream counterparts. This ensures Renovate can detect and apply updates to these branches, maintaining up-to-date dependencies across all relevant branches. PR Close angular#61201
1 parent 0558575 commit 50993be

File tree

1 file changed

+45
-0
lines changed

1 file changed

+45
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This workflow addresses a limitation with Renovate's behavior in fork mode.
2+
# Renovate does not automatically sync non-default branches in forked repositories.
3+
4+
name: Sync angular-robot Forked Repository
5+
on:
6+
workflow_dispatch:
7+
inputs: {}
8+
push:
9+
branches:
10+
# We do no run this on the default branch (main), as this is done by Renovate.
11+
- '[0-9]+.[0-9]+.x'
12+
13+
permissions:
14+
contents: read
15+
16+
jobs:
17+
sync_to_upstream:
18+
runs-on: ubuntu-latest
19+
# Prevents multiple concurrent runs of this workflow for the same branch
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: true
23+
24+
steps:
25+
- name: Checkout the repository
26+
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
27+
with:
28+
ref: ${{ github.ref }} # Checks out the branch that triggered the push
29+
persist-credentials: false
30+
31+
- name: Push to angular-robot upstream remote
32+
run: |
33+
CURRENT_BRANCH="${{ github.ref_name }}"
34+
UPSTREAM_TOKEN="${{ secrets.ANGULAR_ROBOT_ACCESS_TOKEN }}"
35+
UPSTREAM_OWNER="angular-robot"
36+
UPSTREAM_REPO="angular"
37+
UPSTREAM_URL="https://x-access-token:${UPSTREAM_TOKEN}@github.com/${UPSTREAM_OWNER}/${UPSTREAM_REPO}.git"
38+
39+
# The UPSTREAM_TOKEN is automatically masked by GitHub Actions for security.
40+
echo "Adding upstream remote: $UPSTREAM_URL"
41+
git remote add upstream "$UPSTREAM_URL"
42+
git remote -v
43+
44+
echo "Pushing ${{ CURRENT_BRANCH }} from origin to $UPSTREAM_OWNER upstream..."
45+
git push upstream "${CURRENT_BRANCH}"

0 commit comments

Comments
 (0)