Skip to content
Draft
Changes from all commits
Commits
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
77 changes: 77 additions & 0 deletions .github/workflows/sync-upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
name: Sync Upstream

on:
workflow_dispatch:
schedule:
- cron: "0 0 1 * *"
pull_request:
branches: [main]

jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.WORKFLOW_TOKEN }}
fetch-depth: 0

- name: Configure git identity
run: |
git config user.email "github-actions[bot]@users.noreply.github.com"
git config user.name "github-actions[bot]"

- name: Fetch upstream + origin/main (correctamente)
run: |
git remote add upstream https://github.com/jitsi/jitsi-meet.git || true
git fetch upstream --tags
git fetch origin --tags

# 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 Pull Request (solo si hay cambios)
if: steps.check_diff.outputs.diff_exists == 'true'
env:
GH_TOKEN: ${{ secrets.WORKFLOW_TOKEN }}
run: |
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

- 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"
Loading