From 6e41055efae437f69a214335043c00d061440d78 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 10:24:19 +0100 Subject: [PATCH 01/24] ci: sync-upstream Action --- .github/workflows/sync-upstream.yml | 76 +++++++++++++++++++++++++++++ 1 file changed, 76 insertions(+) create mode 100644 .github/workflows/sync-upstream.yml diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml new file mode 100644 index 000000000000..7d8e6bb5e2cd --- /dev/null +++ b/.github/workflows/sync-upstream.yml @@ -0,0 +1,76 @@ +name: Sync with Upstream + +on: + schedule: + # Run at 00:00 UTC on the 1st of every month + - cron: '0 0 1 * *' + workflow_dispatch: # Allows manual trigger from GitHub Actions UI + +jobs: + sync-upstream: + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Configure Git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + + - name: Add upstream remote + run: | + git remote add upstream https://github.com/jitsi/jitsi-meet.git || true + git fetch upstream + + - name: Create sync branch + id: create_branch + run: | + BRANCH_NAME="sync-upstream-$(date +%Y-%m-%d)" + echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT + git checkout -b "$BRANCH_NAME" + + - name: Merge upstream changes + id: merge + continue-on-error: true + run: | + git merge upstream/master --no-edit || echo "merge_conflict=true" >> $GITHUB_OUTPUT + + - name: Push sync branch + run: | + git push origin ${{ steps.create_branch.outputs.branch_name }} + + - name: Create Pull Request + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + CONFLICT_NOTE="" + if [ "${{ steps.merge.outputs.merge_conflict }}" == "true" ]; then + CONFLICT_NOTE="⚠️ **Warning:** This PR contains merge conflicts that need to be resolved manually." + fi + + gh pr create \ + --title "sync: merge upstream changes from jitsi/jitsi-meet" \ + --body "## Upstream Sync - $(date +%Y-%m-%d) + + This PR synchronizes the fork with the upstream repository [jitsi/jitsi-meet](https://github.com/jitsi/jitsi-meet). + + $CONFLICT_NOTE + + ### Changes + This PR includes all changes from the upstream repository since the last sync. + + ### Review Checklist + - [ ] Review all changes from upstream + - [ ] Ensure no conflicts with Internxt-specific customizations + - [ ] Run tests to verify compatibility + - [ ] Check that all custom features still work correctly + + --- + 🤖 This PR was automatically created by the [sync-upstream workflow](.github/workflows/sync-upstream.yml)" \ + --base main \ + --head ${{ steps.create_branch.outputs.branch_name }} From 787c89ee35f7503c88f4d63c677a5f807c88f30d Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 10:32:39 +0100 Subject: [PATCH 02/24] ci: test the action --- .github/workflows/sync-upstream.yml | 118 ++++++++++++++-------------- 1 file changed, 60 insertions(+), 58 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 7d8e6bb5e2cd..d1da20d47839 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -1,76 +1,78 @@ name: Sync with Upstream on: - schedule: - # Run at 00:00 UTC on the 1st of every month - - cron: '0 0 1 * *' - workflow_dispatch: # Allows manual trigger from GitHub Actions UI + schedule: + # Run at 00:00 UTC on the 1st of every month + - cron: "0 0 1 * *" + workflow_dispatch: # Allows manual trigger from GitHub Actions UI + pull_request: + branches: [main] jobs: - sync-upstream: - runs-on: ubuntu-latest + sync-upstream: + runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v4 - with: - fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} + steps: + - name: Checkout repository + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} - - name: Configure Git - run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" + - name: Configure Git + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" - - name: Add upstream remote - run: | - git remote add upstream https://github.com/jitsi/jitsi-meet.git || true - git fetch upstream + - name: Add upstream remote + run: | + git remote add upstream https://github.com/jitsi/jitsi-meet.git || true + git fetch upstream - - name: Create sync branch - id: create_branch - run: | - BRANCH_NAME="sync-upstream-$(date +%Y-%m-%d)" - echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT - git checkout -b "$BRANCH_NAME" + - name: Create sync branch + id: create_branch + run: | + BRANCH_NAME="sync-upstream-$(date +%Y-%m-%d)" + echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT + git checkout -b "$BRANCH_NAME" - - name: Merge upstream changes - id: merge - continue-on-error: true - run: | - git merge upstream/master --no-edit || echo "merge_conflict=true" >> $GITHUB_OUTPUT + - name: Merge upstream changes + id: merge + continue-on-error: true + run: | + git merge upstream/master --no-edit || echo "merge_conflict=true" >> $GITHUB_OUTPUT - - name: Push sync branch - run: | - git push origin ${{ steps.create_branch.outputs.branch_name }} + - name: Push sync branch + run: | + git push origin ${{ steps.create_branch.outputs.branch_name }} - - name: Create Pull Request - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - CONFLICT_NOTE="" - if [ "${{ steps.merge.outputs.merge_conflict }}" == "true" ]; then - CONFLICT_NOTE="⚠️ **Warning:** This PR contains merge conflicts that need to be resolved manually." - fi + - name: Create Pull Request + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + CONFLICT_NOTE="" + if [ "${{ steps.merge.outputs.merge_conflict }}" == "true" ]; then + CONFLICT_NOTE="⚠️ **Warning:** This PR contains merge conflicts that need to be resolved manually." + fi - gh pr create \ - --title "sync: merge upstream changes from jitsi/jitsi-meet" \ - --body "## Upstream Sync - $(date +%Y-%m-%d) + gh pr create \ + --title "sync: merge upstream changes from jitsi/jitsi-meet" \ + --body "## Upstream Sync - $(date +%Y-%m-%d) - This PR synchronizes the fork with the upstream repository [jitsi/jitsi-meet](https://github.com/jitsi/jitsi-meet). + This PR synchronizes the fork with the upstream repository [jitsi/jitsi-meet](https://github.com/jitsi/jitsi-meet). - $CONFLICT_NOTE + $CONFLICT_NOTE - ### Changes - This PR includes all changes from the upstream repository since the last sync. + ### Changes + This PR includes all changes from the upstream repository since the last sync. - ### Review Checklist - - [ ] Review all changes from upstream - - [ ] Ensure no conflicts with Internxt-specific customizations - - [ ] Run tests to verify compatibility - - [ ] Check that all custom features still work correctly + ### Review Checklist + - [ ] Review all changes from upstream + - [ ] Ensure no conflicts with Internxt-specific customizations + - [ ] Run tests to verify compatibility + - [ ] Check that all custom features still work correctly - --- - 🤖 This PR was automatically created by the [sync-upstream workflow](.github/workflows/sync-upstream.yml)" \ - --base main \ - --head ${{ steps.create_branch.outputs.branch_name }} + --- + 🤖 This PR was automatically created by the [sync-upstream workflow](.github/workflows/sync-upstream.yml)" \ + --base main \ + --head ${{ steps.create_branch.outputs.branch_name }} From 92ffa80eb9970b771679e4c4d16a17d7d38295ff Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 10:36:03 +0100 Subject: [PATCH 03/24] feat: adding permissions to the action --- .github/workflows/sync-upstream.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index d1da20d47839..fae58f89e9ce 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -1,5 +1,9 @@ name: Sync with Upstream +permissions: + contents: write + pull-requests: write + on: schedule: # Run at 00:00 UTC on the 1st of every month From c132122d25145bbd35728e6356e9f0e1a8feaf69 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 10:51:38 +0100 Subject: [PATCH 04/24] feat: PAT token to open the PR --- .github/workflows/sync-upstream.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index fae58f89e9ce..c0a5106ff550 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -21,7 +21,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - token: ${{ secrets.GITHUB_TOKEN }} + token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - name: Configure Git run: | @@ -52,7 +52,7 @@ jobs: - name: Create Pull Request env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} run: | CONFLICT_NOTE="" if [ "${{ steps.merge.outputs.merge_conflict }}" == "true" ]; then From ac41eaa7a279735f72ee006732e7fc0ef17a3782 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 11:00:47 +0100 Subject: [PATCH 05/24] ci: add workflow token --- .github/workflows/sync-upstream.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index c0a5106ff550..8bd734d4fd1c 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -21,7 +21,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 - token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + token: ${{ secrets.WORKFLOW_TOKEN }} - name: Configure Git run: | @@ -52,7 +52,7 @@ jobs: - name: Create Pull Request env: - GITHUB_TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} + GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} run: | CONFLICT_NOTE="" if [ "${{ steps.merge.outputs.merge_conflict }}" == "true" ]; then From 7c85e72f9c0619c08a6d7456d81b12a015c8d752 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 11:05:36 +0100 Subject: [PATCH 06/24] ci: update Action --- .github/workflows/sync-upstream.yml | 50 ++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 8bd734d4fd1c..daff63b2ccd8 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -33,7 +33,32 @@ jobs: git remote add upstream https://github.com/jitsi/jitsi-meet.git || true git fetch upstream + - name: Detect upstream default branch + id: detect_branch + run: | + UPSTREAM_BRANCH=$(git remote show upstream | grep "HEAD branch" | cut -d ":" -f 2 | xargs) + echo "upstream_branch=$UPSTREAM_BRANCH" >> $GITHUB_OUTPUT + echo "Detected upstream branch: $UPSTREAM_BRANCH" + + - name: Check for upstream changes + id: check_changes + run: | + UPSTREAM_BRANCH="${{ steps.detect_branch.outputs.upstream_branch }}" + git fetch origin main + CHANGES=$(git rev-list --count origin/main..upstream/$UPSTREAM_BRANCH) + echo "changes_count=$CHANGES" >> $GITHUB_OUTPUT + echo "Number of commits to sync: $CHANGES" + + if [ "$CHANGES" -eq 0 ]; then + echo "has_changes=false" >> $GITHUB_OUTPUT + echo "✅ Repository is already up to date with upstream" + else + echo "has_changes=true" >> $GITHUB_OUTPUT + echo "📦 Found $CHANGES commits to sync" + fi + - name: Create sync branch + if: steps.check_changes.outputs.has_changes == 'true' id: create_branch run: | BRANCH_NAME="sync-upstream-$(date +%Y-%m-%d)" @@ -41,16 +66,29 @@ jobs: git checkout -b "$BRANCH_NAME" - name: Merge upstream changes + if: steps.check_changes.outputs.has_changes == 'true' id: merge continue-on-error: true run: | - git merge upstream/master --no-edit || echo "merge_conflict=true" >> $GITHUB_OUTPUT + UPSTREAM_BRANCH="${{ steps.detect_branch.outputs.upstream_branch }}" + if git merge upstream/$UPSTREAM_BRANCH --no-edit; then + echo "merge_success=true" >> $GITHUB_OUTPUT + echo "✅ Merge successful" + else + echo "merge_conflict=true" >> $GITHUB_OUTPUT + echo "⚠️ Merge conflicts detected" + git merge --abort + git merge upstream/$UPSTREAM_BRANCH --no-commit --no-ff + git commit -m "sync: merge upstream changes from jitsi/jitsi-meet (with conflicts)" + fi - name: Push sync branch + if: steps.check_changes.outputs.has_changes == 'true' run: | git push origin ${{ steps.create_branch.outputs.branch_name }} - name: Create Pull Request + if: steps.check_changes.outputs.has_changes == 'true' env: GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} run: | @@ -59,12 +97,17 @@ jobs: CONFLICT_NOTE="⚠️ **Warning:** This PR contains merge conflicts that need to be resolved manually." fi + CHANGES_COUNT="${{ steps.check_changes.outputs.changes_count }}" + UPSTREAM_BRANCH="${{ steps.detect_branch.outputs.upstream_branch }}" + gh pr create \ --title "sync: merge upstream changes from jitsi/jitsi-meet" \ --body "## Upstream Sync - $(date +%Y-%m-%d) This PR synchronizes the fork with the upstream repository [jitsi/jitsi-meet](https://github.com/jitsi/jitsi-meet). + **📦 Commits to sync:** $CHANGES_COUNT from \`upstream/$UPSTREAM_BRANCH\` + $CONFLICT_NOTE ### Changes @@ -80,3 +123,8 @@ jobs: 🤖 This PR was automatically created by the [sync-upstream workflow](.github/workflows/sync-upstream.yml)" \ --base main \ --head ${{ steps.create_branch.outputs.branch_name }} + + - name: No changes summary + if: steps.check_changes.outputs.has_changes == 'false' + run: | + echo "✅ No sync needed - repository is already up to date with upstream" From 828b43c58e7fdc146b21a778b9093fd9a7b31365 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 11:12:03 +0100 Subject: [PATCH 07/24] feat: update env variable --- .github/workflows/sync-upstream.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index daff63b2ccd8..0cb5518052d9 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -9,8 +9,6 @@ on: # Run at 00:00 UTC on the 1st of every month - cron: "0 0 1 * *" workflow_dispatch: # Allows manual trigger from GitHub Actions UI - pull_request: - branches: [main] jobs: sync-upstream: @@ -57,6 +55,10 @@ jobs: echo "📦 Found $CHANGES commits to sync" fi + - name: Wait for branch to become available + if: steps.check_changes.outputs.has_changes == 'true' + run: sleep 5 + - name: Create sync branch if: steps.check_changes.outputs.has_changes == 'true' id: create_branch @@ -90,7 +92,7 @@ jobs: - name: Create Pull Request if: steps.check_changes.outputs.has_changes == 'true' env: - GITHUB_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} + GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} run: | CONFLICT_NOTE="" if [ "${{ steps.merge.outputs.merge_conflict }}" == "true" ]; then From 7301ae74d34a66ad8ed988c6996bf61ed95a3fc1 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 11:18:23 +0100 Subject: [PATCH 08/24] fix: remove useless code --- .github/workflows/sync-upstream.yml | 67 +++++++++++++++++++---------- 1 file changed, 45 insertions(+), 22 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 0cb5518052d9..c97e73f65e1a 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -55,10 +55,6 @@ jobs: echo "📦 Found $CHANGES commits to sync" fi - - name: Wait for branch to become available - if: steps.check_changes.outputs.has_changes == 'true' - run: sleep 5 - - name: Create sync branch if: steps.check_changes.outputs.has_changes == 'true' id: create_branch @@ -89,10 +85,9 @@ jobs: run: | git push origin ${{ steps.create_branch.outputs.branch_name }} - - name: Create Pull Request + - name: Prepare PR body from template if: steps.check_changes.outputs.has_changes == 'true' - env: - GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} + id: pr_body run: | CONFLICT_NOTE="" if [ "${{ steps.merge.outputs.merge_conflict }}" == "true" ]; then @@ -102,27 +97,55 @@ jobs: CHANGES_COUNT="${{ steps.check_changes.outputs.changes_count }}" UPSTREAM_BRANCH="${{ steps.detect_branch.outputs.upstream_branch }}" - gh pr create \ - --title "sync: merge upstream changes from jitsi/jitsi-meet" \ - --body "## Upstream Sync - $(date +%Y-%m-%d) + # Create PR body + cat > /tmp/pr_body.md << 'EOFTEMPLATE' + ## Description + + Synchronizes the fork with upstream [jitsi/jitsi-meet](https://github.com/jitsi/jitsi-meet). + + **📦 Commits to sync:** CHANGES_COUNT_PLACEHOLDER from `upstream/UPSTREAM_BRANCH_PLACEHOLDER` + + CONFLICT_NOTE_PLACEHOLDER + + ## Related Issues + + N/A - Automated upstream synchronization - This PR synchronizes the fork with the upstream repository [jitsi/jitsi-meet](https://github.com/jitsi/jitsi-meet). + ## Related Pull Requests - **📦 Commits to sync:** $CHANGES_COUNT from \`upstream/$UPSTREAM_BRANCH\` + - [jitsi/jitsi-meet](https://github.com/jitsi/jitsi-meet/commits/UPSTREAM_BRANCH_PLACEHOLDER) - $CONFLICT_NOTE + ## Checklist - ### Changes - This PR includes all changes from the upstream repository since the last sync. + - [ ] Changes have been tested locally. + - [ ] No new warnings or errors have been introduced. + - [ ] SonarCloud issues have been reviewed and addressed. + - [ ] Ensure no conflicts with Internxt-specific customizations. + - [ ] Verify all custom features still work correctly. + - [ ] QA Passed - ### Review Checklist - - [ ] Review all changes from upstream - - [ ] Ensure no conflicts with Internxt-specific customizations - - [ ] Run tests to verify compatibility - - [ ] Check that all custom features still work correctly + ## How Has This Been Tested? - --- - 🤖 This PR was automatically created by the [sync-upstream workflow](.github/workflows/sync-upstream.yml)" \ + Run `npm run lint:ci && npm run tsc:ci && make dev` and test Internxt-specific features. + + ## Additional Notes + + 🤖 Automatically created by the [sync-upstream workflow](.github/workflows/sync-upstream.yml). + + # Replace placeholders + sed -i "s/CHANGES_COUNT_PLACEHOLDER/$CHANGES_COUNT/g" /tmp/pr_body.md + sed -i "s/UPSTREAM_BRANCH_PLACEHOLDER/$UPSTREAM_BRANCH/g" /tmp/pr_body.md + sed -i "s/SYNC_DATE_PLACEHOLDER/$(date +%Y-%m-%d)/g" /tmp/pr_body.md + sed -i "s/CONFLICT_NOTE_PLACEHOLDER/$CONFLICT_NOTE/g" /tmp/pr_body.md + + - name: Create Pull Request + if: steps.check_changes.outputs.has_changes == 'true' + env: + GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} + run: | + gh pr create \ + --title "sync: merge upstream changes from jitsi/jitsi-meet" \ + --body-file /tmp/pr_body.md \ --base main \ --head ${{ steps.create_branch.outputs.branch_name }} From d7a6742427410dc60736b928fd67009b99741c4b Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 11:33:49 +0100 Subject: [PATCH 09/24] fix: remove useless code --- .github/workflows/sync-upstream.yml | 119 ++++++---------------------- 1 file changed, 26 insertions(+), 93 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index c97e73f65e1a..97f465cee519 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -1,17 +1,18 @@ -name: Sync with Upstream +name: Sync Upstream permissions: contents: write pull-requests: write on: + workflow_dispatch: schedule: - # Run at 00:00 UTC on the 1st of every month - cron: "0 0 1 * *" - workflow_dispatch: # Allows manual trigger from GitHub Actions UI + pull_request: + branches: [main] jobs: - sync-upstream: + sync: runs-on: ubuntu-latest steps: @@ -43,113 +44,45 @@ jobs: run: | UPSTREAM_BRANCH="${{ steps.detect_branch.outputs.upstream_branch }}" git fetch origin main - CHANGES=$(git rev-list --count origin/main..upstream/$UPSTREAM_BRANCH) + CHANGES=$(git rev-list --count origin/main..upstream/$UPSTREAM_BRANCH || echo "0") echo "changes_count=$CHANGES" >> $GITHUB_OUTPUT - echo "Number of commits to sync: $CHANGES" - if [ "$CHANGES" -eq 0 ]; then echo "has_changes=false" >> $GITHUB_OUTPUT - echo "✅ Repository is already up to date with upstream" else echo "has_changes=true" >> $GITHUB_OUTPUT - echo "📦 Found $CHANGES commits to sync" fi + - name: Stop if no changes + if: steps.check_changes.outputs.has_changes == 'false' + run: echo "✅ No upstream changes — Nothing to do." + - name: Create sync branch if: steps.check_changes.outputs.has_changes == 'true' id: create_branch run: | - BRANCH_NAME="sync-upstream-$(date +%Y-%m-%d)" - echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT - git checkout -b "$BRANCH_NAME" + BRANCH="sync-upstream-$(date +%Y-%m-%d)" + echo "branch=$BRANCH" >> $GITHUB_OUTPUT + git checkout -b "$BRANCH" - name: Merge upstream changes if: steps.check_changes.outputs.has_changes == 'true' - id: merge - continue-on-error: true run: | UPSTREAM_BRANCH="${{ steps.detect_branch.outputs.upstream_branch }}" - if git merge upstream/$UPSTREAM_BRANCH --no-edit; then - echo "merge_success=true" >> $GITHUB_OUTPUT - echo "✅ Merge successful" - else - echo "merge_conflict=true" >> $GITHUB_OUTPUT - echo "⚠️ Merge conflicts detected" - git merge --abort - git merge upstream/$UPSTREAM_BRANCH --no-commit --no-ff - git commit -m "sync: merge upstream changes from jitsi/jitsi-meet (with conflicts)" - fi + git merge upstream/$UPSTREAM_BRANCH --no-edit || true + git add . + git commit -m "sync: merge upstream changes" || true - - name: Push sync branch + - name: Push branch if: steps.check_changes.outputs.has_changes == 'true' run: | - git push origin ${{ steps.create_branch.outputs.branch_name }} + git push origin ${{ steps.create_branch.outputs.branch }} - - name: Prepare PR body from template + - name: Open Pull Request if: steps.check_changes.outputs.has_changes == 'true' - id: pr_body - run: | - CONFLICT_NOTE="" - if [ "${{ steps.merge.outputs.merge_conflict }}" == "true" ]; then - CONFLICT_NOTE="⚠️ **Warning:** This PR contains merge conflicts that need to be resolved manually." - fi - - CHANGES_COUNT="${{ steps.check_changes.outputs.changes_count }}" - UPSTREAM_BRANCH="${{ steps.detect_branch.outputs.upstream_branch }}" - - # Create PR body - cat > /tmp/pr_body.md << 'EOFTEMPLATE' - ## Description - - Synchronizes the fork with upstream [jitsi/jitsi-meet](https://github.com/jitsi/jitsi-meet). - - **📦 Commits to sync:** CHANGES_COUNT_PLACEHOLDER from `upstream/UPSTREAM_BRANCH_PLACEHOLDER` - - CONFLICT_NOTE_PLACEHOLDER - - ## Related Issues - - N/A - Automated upstream synchronization - - ## Related Pull Requests - - - [jitsi/jitsi-meet](https://github.com/jitsi/jitsi-meet/commits/UPSTREAM_BRANCH_PLACEHOLDER) - - ## Checklist - - - [ ] Changes have been tested locally. - - [ ] No new warnings or errors have been introduced. - - [ ] SonarCloud issues have been reviewed and addressed. - - [ ] Ensure no conflicts with Internxt-specific customizations. - - [ ] Verify all custom features still work correctly. - - [ ] QA Passed - - ## How Has This Been Tested? - - Run `npm run lint:ci && npm run tsc:ci && make dev` and test Internxt-specific features. - - ## Additional Notes - - 🤖 Automatically created by the [sync-upstream workflow](.github/workflows/sync-upstream.yml). - - # Replace placeholders - sed -i "s/CHANGES_COUNT_PLACEHOLDER/$CHANGES_COUNT/g" /tmp/pr_body.md - sed -i "s/UPSTREAM_BRANCH_PLACEHOLDER/$UPSTREAM_BRANCH/g" /tmp/pr_body.md - sed -i "s/SYNC_DATE_PLACEHOLDER/$(date +%Y-%m-%d)/g" /tmp/pr_body.md - sed -i "s/CONFLICT_NOTE_PLACEHOLDER/$CONFLICT_NOTE/g" /tmp/pr_body.md - - - name: Create Pull Request - if: steps.check_changes.outputs.has_changes == 'true' - env: - GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} - run: | - gh pr create \ - --title "sync: merge upstream changes from jitsi/jitsi-meet" \ - --body-file /tmp/pr_body.md \ - --base main \ - --head ${{ steps.create_branch.outputs.branch_name }} - - - name: No changes summary - if: steps.check_changes.outputs.has_changes == 'false' - run: | - echo "✅ No sync needed - repository is already up to date with upstream" + uses: repo-sync/pull-request@v2 + with: + source_branch: ${{ steps.create_branch.outputs.branch }} + destination_branch: "main" + pr_title: "sync: Merge upstream changes" + pr_body: "Automated sync from upstream." + github_token: ${{ secrets.GITHUB_TOKEN }} From 27bf2834957b08c2ff4b82b4d36da530bd0cb4d2 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 11:37:03 +0100 Subject: [PATCH 10/24] ci: update GH token --- .github/workflows/sync-upstream.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 97f465cee519..75afffbff484 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -85,4 +85,4 @@ jobs: destination_branch: "main" pr_title: "sync: Merge upstream changes" pr_body: "Automated sync from upstream." - github_token: ${{ secrets.GITHUB_TOKEN }} + github_token: ${{ secrets.WORKFLOW_TOKEN }} From 19da6f1bae213144e8c6a81450c3ebde1d8e1a7c Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 12:21:07 +0100 Subject: [PATCH 11/24] ci: update upstream workflow --- .github/workflows/sync-upstream.yml | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 75afffbff484..b24bddabf0b3 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -33,18 +33,26 @@ jobs: git fetch upstream - name: Detect upstream default branch - id: detect_branch + id: detect_upstream_branch run: | UPSTREAM_BRANCH=$(git remote show upstream | grep "HEAD branch" | cut -d ":" -f 2 | xargs) echo "upstream_branch=$UPSTREAM_BRANCH" >> $GITHUB_OUTPUT echo "Detected upstream branch: $UPSTREAM_BRANCH" + - name: Detect fork default branch + id: detect_fork_branch + run: | + FORK_BRANCH=$(git remote show origin | grep "HEAD branch" | cut -d ":" -f 2 | xargs) + echo "fork_branch=$FORK_BRANCH" >> $GITHUB_OUTPUT + echo "Detected fork branch: $FORK_BRANCH" + - name: Check for upstream changes id: check_changes run: | - UPSTREAM_BRANCH="${{ steps.detect_branch.outputs.upstream_branch }}" - git fetch origin main - CHANGES=$(git rev-list --count origin/main..upstream/$UPSTREAM_BRANCH || echo "0") + UPSTREAM_BRANCH="${{ steps.detect_upstream_branch.outputs.upstream_branch }}" + FORK_BRANCH="${{ steps.detect_fork_branch.outputs.fork_branch }}" + git fetch origin $FORK_BRANCH + CHANGES=$(git rev-list --count origin/$FORK_BRANCH..upstream/$UPSTREAM_BRANCH || echo "0") echo "changes_count=$CHANGES" >> $GITHUB_OUTPUT if [ "$CHANGES" -eq 0 ]; then echo "has_changes=false" >> $GITHUB_OUTPUT @@ -67,22 +75,22 @@ jobs: - name: Merge upstream changes if: steps.check_changes.outputs.has_changes == 'true' run: | - UPSTREAM_BRANCH="${{ steps.detect_branch.outputs.upstream_branch }}" + UPSTREAM_BRANCH="${{ steps.detect_upstream_branch.outputs.upstream_branch }}" git merge upstream/$UPSTREAM_BRANCH --no-edit || true git add . git commit -m "sync: merge upstream changes" || true - - name: Push branch + - name: Push branch to fork if: steps.check_changes.outputs.has_changes == 'true' run: | git push origin ${{ steps.create_branch.outputs.branch }} - - name: Open Pull Request + - name: Open Pull Request in fork if: steps.check_changes.outputs.has_changes == 'true' uses: repo-sync/pull-request@v2 with: source_branch: ${{ steps.create_branch.outputs.branch }} - destination_branch: "main" + destination_branch: ${{ steps.detect_fork_branch.outputs.fork_branch }} pr_title: "sync: Merge upstream changes" pr_body: "Automated sync from upstream." github_token: ${{ secrets.WORKFLOW_TOKEN }} From 96eb698d1175d2e95bc73ba2edd27c1f7220ecaa Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 12:41:14 +0100 Subject: [PATCH 12/24] ci: use the correct destination_branch --- .github/workflows/sync-upstream.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index b24bddabf0b3..f11234e0d308 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -90,7 +90,7 @@ jobs: uses: repo-sync/pull-request@v2 with: source_branch: ${{ steps.create_branch.outputs.branch }} - destination_branch: ${{ steps.detect_fork_branch.outputs.fork_branch }} + destination_branch: main pr_title: "sync: Merge upstream changes" pr_body: "Automated sync from upstream." github_token: ${{ secrets.WORKFLOW_TOKEN }} From ae3f7dda9649077c74db5be879f171d3a4b85b1a Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 12:47:08 +0100 Subject: [PATCH 13/24] ci: update action --- .github/workflows/sync-upstream.yml | 76 ++++++----------------------- 1 file changed, 14 insertions(+), 62 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index f11234e0d308..8f0d9ac0cb9b 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -16,81 +16,33 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout repository + - name: Checkout fork repo uses: actions/checkout@v4 with: fetch-depth: 0 - token: ${{ secrets.WORKFLOW_TOKEN }} - - name: Configure Git + - name: Setup GitHub CLI run: | - git config user.name "github-actions[bot]" - git config user.email "github-actions[bot]@users.noreply.github.com" + sudo apt-get install -y gh + echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token - name: Add upstream remote run: | - git remote add upstream https://github.com/jitsi/jitsi-meet.git || true + git remote add upstream https://github.com/OWNER/REPO_ORIGINAL.git git fetch upstream - - name: Detect upstream default branch - id: detect_upstream_branch - run: | - UPSTREAM_BRANCH=$(git remote show upstream | grep "HEAD branch" | cut -d ":" -f 2 | xargs) - echo "upstream_branch=$UPSTREAM_BRANCH" >> $GITHUB_OUTPUT - echo "Detected upstream branch: $UPSTREAM_BRANCH" - - - name: Detect fork default branch - id: detect_fork_branch - run: | - FORK_BRANCH=$(git remote show origin | grep "HEAD branch" | cut -d ":" -f 2 | xargs) - echo "fork_branch=$FORK_BRANCH" >> $GITHUB_OUTPUT - echo "Detected fork branch: $FORK_BRANCH" - - - name: Check for upstream changes - id: check_changes - run: | - UPSTREAM_BRANCH="${{ steps.detect_upstream_branch.outputs.upstream_branch }}" - FORK_BRANCH="${{ steps.detect_fork_branch.outputs.fork_branch }}" - git fetch origin $FORK_BRANCH - CHANGES=$(git rev-list --count origin/$FORK_BRANCH..upstream/$UPSTREAM_BRANCH || echo "0") - echo "changes_count=$CHANGES" >> $GITHUB_OUTPUT - if [ "$CHANGES" -eq 0 ]; then - echo "has_changes=false" >> $GITHUB_OUTPUT - else - echo "has_changes=true" >> $GITHUB_OUTPUT - fi - - - name: Stop if no changes - if: steps.check_changes.outputs.has_changes == 'false' - run: echo "✅ No upstream changes — Nothing to do." - - name: Create sync branch - if: steps.check_changes.outputs.has_changes == 'true' - id: create_branch run: | - BRANCH="sync-upstream-$(date +%Y-%m-%d)" - echo "branch=$BRANCH" >> $GITHUB_OUTPUT - git checkout -b "$BRANCH" + git checkout -B upstream-sync upstream/main - - name: Merge upstream changes - if: steps.check_changes.outputs.has_changes == 'true' + - name: Push upstream-sync branch to fork run: | - UPSTREAM_BRANCH="${{ steps.detect_upstream_branch.outputs.upstream_branch }}" - git merge upstream/$UPSTREAM_BRANCH --no-edit || true - git add . - git commit -m "sync: merge upstream changes" || true + git push -f origin upstream-sync - - name: Push branch to fork - if: steps.check_changes.outputs.has_changes == 'true' + - name: Create Pull Request run: | - git push origin ${{ steps.create_branch.outputs.branch }} - - - name: Open Pull Request in fork - if: steps.check_changes.outputs.has_changes == 'true' - uses: repo-sync/pull-request@v2 - with: - source_branch: ${{ steps.create_branch.outputs.branch }} - destination_branch: main - pr_title: "sync: Merge upstream changes" - pr_body: "Automated sync from upstream." - github_token: ${{ secrets.WORKFLOW_TOKEN }} + gh pr create \ + --base main \ + --head upstream-sync \ + --title "Sync with upstream main" \ + --body "This PR syncs the fork with upstream main. Conflicts may be present and require manual resolution." From c795e6575bb2748eff541c207c392fcc9dee931c Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 12:48:52 +0100 Subject: [PATCH 14/24] ci: add the correct upstream repo --- .github/workflows/sync-upstream.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 8f0d9ac0cb9b..7cc50062e38d 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -28,7 +28,7 @@ jobs: - name: Add upstream remote run: | - git remote add upstream https://github.com/OWNER/REPO_ORIGINAL.git + git remote add upstream https://github.com/jitsi/jitsi-meet.git git fetch upstream - name: Create sync branch From 2adebe8a58c79a6ee541b666c0430c20033e57ca Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 12:50:19 +0100 Subject: [PATCH 15/24] fix: update upstream master branch --- .github/workflows/sync-upstream.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 7cc50062e38d..9876b5ada4b7 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -33,7 +33,7 @@ jobs: - name: Create sync branch run: | - git checkout -B upstream-sync upstream/main + git checkout -B upstream-sync upstream/master - name: Push upstream-sync branch to fork run: | From d29c6d0a50bd097d80bcc34d7f98f23d58a76947 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:01:10 +0100 Subject: [PATCH 16/24] fix: remove useless push --- .github/workflows/sync-upstream.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 9876b5ada4b7..127adad54620 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -35,10 +35,6 @@ jobs: run: | git checkout -B upstream-sync upstream/master - - name: Push upstream-sync branch to fork - run: | - git push -f origin upstream-sync - - name: Create Pull Request run: | gh pr create \ From 7257e7793a395ea3e7e75f38570d3d2c671db2cf Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:03:33 +0100 Subject: [PATCH 17/24] ci: use a custom PAT to the aGH actions --- .github/workflows/sync-upstream.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 127adad54620..794c21688f92 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -35,7 +35,15 @@ jobs: run: | git checkout -B upstream-sync upstream/master + - name: Push upstream-sync branch to fork + env: + GITHUB_TOKEN: ${{secrets.WORKFLOW_TOKEN}} + run: | + git push -f origin upstream-sync + - name: Create Pull Request + env: + GITHUB_TOKEN: ${{secrets.WORKFLOW_TOKEN}} run: | gh pr create \ --base main \ From a32b72dcb599551a251d5e9cddef2a2c51ab4398 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:13:32 +0100 Subject: [PATCH 18/24] ci: remove workflows from upstream branch --- .github/workflows/sync-upstream.yml | 57 +++++++++++++++++++---------- 1 file changed, 38 insertions(+), 19 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 794c21688f92..41448852be63 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -1,5 +1,6 @@ name: Sync Upstream +# Permisos mínimos con GITHUB_TOKEN permissions: contents: write pull-requests: write @@ -12,41 +13,59 @@ on: branches: [main] jobs: - sync: + sync-upstream: runs-on: ubuntu-latest - steps: - - name: Checkout fork repo + - name: Checkout fork uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Setup GitHub CLI - run: | - sudo apt-get install -y gh - echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token - - name: Add upstream remote run: | - git remote add upstream https://github.com/jitsi/jitsi-meet.git + git remote add upstream https://github.com/jitsi/jitsi-meet.git || true git fetch upstream - - name: Create sync branch + - name: Create sync branch from upstream/master run: | git checkout -B upstream-sync upstream/master - - name: Push upstream-sync branch to fork - env: - GITHUB_TOKEN: ${{secrets.WORKFLOW_TOKEN}} + - name: Remove upstream workflows (solve permission error) + run: | + # Borramos todos los workflows del upstream para que GITHUB_TOKEN permita el push + rm -rf .github/workflows/ + git add .github/workflows/ 2>/dev/null || echo "No workflows directory" + git commit -m "chore: remove upstream GitHub Actions workflows (auto-sync)" || echo "Nothing to commit" + + - name: Push sync branch (force) run: | git push -f origin upstream-sync - - name: Create Pull Request - env: - GITHUB_TOKEN: ${{secrets.WORKFLOW_TOKEN}} + - name: Check if sync PR already exists + id: check_pr + run: | + if gh pr list --state open --head upstream-sync | grep -q upstream-sync; then + echo "exists=true" >> $GITHUB_OUTPUT + else + echo "exists=false" >> $GITHUB_OUTPUT + fi + + - name: Create or update Pull Request + if: steps.check_pr.outputs.exists == 'false' run: | gh pr create \ + --title "chore(sync): update from upstream jitsi/jitsi-meet" \ + --body "Automated monthly sync with upstream repository. + + - Upstream commit: $(git rev-parse --short upstream/master) + - Date: $(date -u) + + Upstream workflows have been automatically removed to allow the sync. + Review changes carefully before merging." \ --base main \ - --head upstream-sync \ - --title "Sync with upstream main" \ - --body "This PR syncs the fork with upstream main. Conflicts may be present and require manual resolution." + --head upstream-sync + + - name: PR already exists notification + if: steps.check_pr.outputs.exists == 'true' + run: | + echo "Pull request already exists → nothing to do this month" From d6f860db0ad3e43c53b9f34ca7e6b4412cd03259 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:17:31 +0100 Subject: [PATCH 19/24] ci: update action --- .github/workflows/sync-upstream.yml | 44 +++++++++++++---------------- 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 41448852be63..0f751c12c928 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -1,6 +1,5 @@ name: Sync Upstream -# Permisos mínimos con GITHUB_TOKEN permissions: contents: write pull-requests: write @@ -8,7 +7,7 @@ permissions: on: workflow_dispatch: schedule: - - cron: "0 0 1 * *" + - cron: "0 0 1 * *" # Día 1 de cada mes a las 00:00 UTC pull_request: branches: [main] @@ -20,22 +19,32 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + ref: main # Aseguramos que partimos de main - name: Add upstream remote run: | git remote add upstream https://github.com/jitsi/jitsi-meet.git || true git fetch upstream - - name: Create sync branch from upstream/master + - name: Create sync branch WITHOUT upstream workflows run: | + # Creamos la rama desde upstream/master, pero excluyendo workflows desde el inicio git checkout -B upstream-sync upstream/master - - name: Remove upstream workflows (solve permission error) - run: | - # Borramos todos los workflows del upstream para que GITHUB_TOKEN permita el push + # Borramos workflows inmediatamente (antes de cualquier commit) rm -rf .github/workflows/ - git add .github/workflows/ 2>/dev/null || echo "No workflows directory" - git commit -m "chore: remove upstream GitHub Actions workflows (auto-sync)" || echo "Nothing to commit" + + # Añadimos solo nuestros workflows locales (si existen) para preservarlos + if [ -d .github/workflows/ ]; then + echo "Preserving local workflows" + else + mkdir -p .github/workflows/ + echo "# Preserved local workflows" > .github/workflows/sync-upstream.yml # Placeholder para no dejar vacío + fi + + # Commit de los cambios (borrado + preservación) + git add .github/workflows/ || true + git commit -m "chore(sync): remove upstream workflows and preserve ours" || echo "No changes to commit" - name: Push sync branch (force) run: | @@ -50,22 +59,9 @@ jobs: echo "exists=false" >> $GITHUB_OUTPUT fi - - name: Create or update Pull Request + - name: Create Pull Request if: steps.check_pr.outputs.exists == 'false' run: | gh pr create \ - --title "chore(sync): update from upstream jitsi/jitsi-meet" \ - --body "Automated monthly sync with upstream repository. - - - Upstream commit: $(git rev-parse --short upstream/master) - - Date: $(date -u) - - Upstream workflows have been automatically removed to allow the sync. - Review changes carefully before merging." \ - --base main \ - --head upstream-sync - - - name: PR already exists notification - if: steps.check_pr.outputs.exists == 'true' - run: | - echo "Pull request already exists → nothing to do this month" + --title "chore(sync): monthly update from upstream jitsi/jitsi-meet" \ + --body "Automated sync with upstream (commit: \$(git rev-parse --short upstream/master)). From 1f562d12b619f4c3c00e5016229b7d1a7cbec6b4 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:21:00 +0100 Subject: [PATCH 20/24] ci: use the workflow token --- .github/workflows/sync-upstream.yml | 59 ++++++++++++----------------- 1 file changed, 24 insertions(+), 35 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 0f751c12c928..ad03402bdf97 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -12,56 +12,45 @@ on: branches: [main] jobs: - sync-upstream: + sync: runs-on: ubuntu-latest steps: - - name: Checkout fork + - name: Checkout repository uses: actions/checkout@v4 with: + token: ${{ secrets.WORKFLOW_TOKEN }} fetch-depth: 0 - ref: main # Aseguramos que partimos de main + + - name: Configure git identity + run: | + git config user.email "github-actions[bot]@users.noreply.github.com" + git config user.name "github-actions[bot]" - name: Add upstream remote run: | git remote add upstream https://github.com/jitsi/jitsi-meet.git || true git fetch upstream - - name: Create sync branch WITHOUT upstream workflows + - name: Create and push sync branch run: | - # Creamos la rama desde upstream/master, pero excluyendo workflows desde el inicio git checkout -B upstream-sync upstream/master - - # Borramos workflows inmediatamente (antes de cualquier commit) - rm -rf .github/workflows/ - - # Añadimos solo nuestros workflows locales (si existen) para preservarlos - if [ -d .github/workflows/ ]; then - echo "Preserving local workflows" - else - mkdir -p .github/workflows/ - echo "# Preserved local workflows" > .github/workflows/sync-upstream.yml # Placeholder para no dejar vacío - fi - - # Commit de los cambios (borrado + preservación) - git add .github/workflows/ || true - git commit -m "chore(sync): remove upstream workflows and preserve ours" || echo "No changes to commit" - - - name: Push sync branch (force) - run: | git push -f origin upstream-sync - - name: Check if sync PR already exists - id: check_pr + - name: Create or update Pull Request + env: + GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} run: | - if gh pr list --state open --head upstream-sync | grep -q upstream-sync; then - echo "exists=true" >> $GITHUB_OUTPUT + if gh pr list --head upstream-sync --state open --json number | jq -e 'length > 0' > /dev/null; then + echo "PR already exists → nothing to do" else - echo "exists=false" >> $GITHUB_OUTPUT - fi + gh pr create \ + --title "chore(sync): monthly sync with jitsi/jitsi-meet" \ + --body "Automated monthly sync from upstream jitsi/jitsi-meet - - name: Create Pull Request - if: steps.check_pr.outputs.exists == 'false' - run: | - gh pr create \ - --title "chore(sync): monthly update from upstream jitsi/jitsi-meet" \ - --body "Automated sync with upstream (commit: \$(git rev-parse --short upstream/master)). + Upstream commit: $(git rev-parse --short upstream/master) + + Includes upstream workflows (token has workflow permission)." \ + --base main \ + --head upstream-sync \ + --label "automated,sync" + fi From 668e89564157a097961da49233d8f1bbce681702 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:31:14 +0100 Subject: [PATCH 21/24] fix: remove useless label --- .github/workflows/sync-upstream.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index ad03402bdf97..eb0a48919daa 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -52,5 +52,4 @@ jobs: Includes upstream workflows (token has workflow permission)." \ --base main \ --head upstream-sync \ - --label "automated,sync" fi From e22ada1bca86180bd37a5acb1d77d686754a63e9 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:34:12 +0100 Subject: [PATCH 22/24] fix: add correct label --- .github/workflows/sync-upstream.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index eb0a48919daa..c8bae262b3dd 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -52,4 +52,5 @@ jobs: Includes upstream workflows (token has workflow permission)." \ --base main \ --head upstream-sync \ + --label "enhancement" fi From 6e09663d379dcf1259a9d2db3f3bd043c3287b63 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:36:37 +0100 Subject: [PATCH 23/24] fix: remove useless label field --- .github/workflows/sync-upstream.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index c8bae262b3dd..4933e2740bb6 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -51,6 +51,5 @@ jobs: Includes upstream workflows (token has workflow permission)." \ --base main \ - --head upstream-sync \ - --label "enhancement" + --head upstream-sync fi From c1d8d49f1e36e0a61ad5dc34644cc0c59b789771 Mon Sep 17 00:00:00 2001 From: Xavier Abad <77491413+xabg2@users.noreply.github.com> Date: Tue, 25 Nov 2025 13:39:31 +0100 Subject: [PATCH 24/24] ci: update workflow --- .github/workflows/sync-upstream.yml | 58 ++++++++++++++++++++--------- 1 file changed, 40 insertions(+), 18 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 4933e2740bb6..66d65e4e5473 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -1,13 +1,9 @@ name: Sync Upstream -permissions: - contents: write - pull-requests: write - on: workflow_dispatch: schedule: - - cron: "0 0 1 * *" # Día 1 de cada mes a las 00:00 UTC + - cron: "0 0 1 * *" pull_request: branches: [main] @@ -26,30 +22,56 @@ jobs: git config user.email "github-actions[bot]@users.noreply.github.com" git config user.name "github-actions[bot]" - - name: Add upstream remote + - name: Fetch upstream + origin/main (correctamente) run: | git remote add upstream https://github.com/jitsi/jitsi-meet.git || true - git fetch upstream + git fetch upstream --tags + git fetch origin --tags - - name: Create and push sync branch + # COMPARACIÓN CORRECTA: usamos los refs remotos directamente + - name: Check if there are new commits in upstream + id: check_diff + run: | + MAIN_SHA=$(git rev-parse origin/main) + UPSTREAM_SHA=$(git rev-parse upstream/master) + + echo "origin/main → $MAIN_SHA" + echo "upstream/master → $UPSTREAM_SHA" + + if [ "$MAIN_SHA" = "$UPSTREAM_SHA" ]; then + echo "already_synced=true" >> $GITHUB_OUTPUT + echo "No hay cambios nuevos en upstream" + else + echo "already_synced=false" >> $GITHUB_OUTPUT + echo "diff_exists=true" >> $GITHUB_OUTPUT + echo "¡HAY CAMBIOS! (o conflictos) → se creará el PR" + fi + + - name: Create and push upstream-sync branch + if: steps.check_diff.outputs.diff_exists == 'true' run: | git checkout -B upstream-sync upstream/master git push -f origin upstream-sync - - name: Create or update Pull Request + - name: Create Pull Request (solo si hay cambios) + if: steps.check_diff.outputs.diff_exists == 'true' env: GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }} run: | - if gh pr list --head upstream-sync --state open --json number | jq -e 'length > 0' > /dev/null; then - echo "PR already exists → nothing to do" - else - gh pr create \ - --title "chore(sync): monthly sync with jitsi/jitsi-meet" \ - --body "Automated monthly sync from upstream jitsi/jitsi-meet + gh pr create \ + --title "chore(sync): monthly sync with upstream jitsi/jitsi-meet" \ + --body "Automated monthly sync from upstream Upstream commit: $(git rev-parse --short upstream/master) + Your main commit: $(git rev-parse --short origin/main) + Date: $(date -u) + This PR may contain **merge conflicts** that need manual resolution. Includes upstream workflows (token has workflow permission)." \ - --base main \ - --head upstream-sync - fi + --base main \ + --head upstream-sync + + - name: Already up to date + if: steps.check_diff.outputs.already_synced == 'true' + run: | + echo "Fork ya está completamente actualizado con upstream/master → nada que hacer"