From 93a132f884051e7ac622deafaf75ea73a717cfc9 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 15:25:19 +0000 Subject: [PATCH 1/7] Initial plan From c836ad6b31bbc3f43415878d6837e2e120aee429 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 15:27:25 +0000 Subject: [PATCH 2/7] Replace sync-upstream.yml with improved version that handles all fork-specific files Co-authored-by: carstenartur <3164220+carstenartur@users.noreply.github.com> --- .github/workflows/sync-upstream.yml | 381 +++++++++++++--------------- 1 file changed, 182 insertions(+), 199 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 59a025b10d..fd132c8621 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -1,4 +1,4 @@ -name: Sync Fork with Upstream Master +name: Sync Fork with Upstream on: schedule: @@ -9,134 +9,143 @@ on: jobs: sync-scheduled: - name: Sync Fork with Upstream (Scheduled) + name: Sync Fork (Scheduled) if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' runs-on: ubuntu-latest permissions: contents: write steps: - - name: Checkout master branch + - name: Checkout fork master uses: actions/checkout@v4 with: ref: master - token: ${{ secrets.GITHUB_TOKEN }} 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: Sync with upstream and squash fork-specific commits - id: sync + - name: Add upstream remote run: | - set -e - - echo "Adding upstream remote..." - git remote add upstream https://github.com/eclipse-jdt/eclipse.jdt.debug.git || true - - echo "Fetching from upstream and origin..." + git remote add upstream https://github.com/eclipse-jdt/eclipse.jdt.debug.git git fetch upstream master - git fetch origin master - - # Check if there are new commits in upstream - echo "Checking for new commits in upstream..." - UPSTREAM_SHA=$(git rev-parse upstream/master) - CURRENT_SHA=$(git rev-parse origin/master) - - # Get the base commit (where fork diverged from upstream) - BASE_SHA=$(git merge-base origin/master upstream/master 2>/dev/null || echo "") + + - name: Identify and backup fork-specific files + id: backup + run: | + # Create temporary directory for fork-specific files + mkdir -p /tmp/fork-specific - if [ "$UPSTREAM_SHA" = "$BASE_SHA" ]; then - echo "No new commits in upstream. Skipping sync." - echo "sync_needed=false" >> $GITHUB_OUTPUT - exit 0 - fi + # Identify fork-specific workflow files (files that don't exist in upstream) + git fetch upstream master - echo "New commits found in upstream." - echo "sync_needed=true" >> $GITHUB_OUTPUT + # Get list of workflow files in fork + FORK_WORKFLOWS=$(git ls-tree -r HEAD --name-only .github/workflows/ 2>/dev/null || echo "") - echo "Identifying fork-specific files..." - # Get list of files that exist in origin/master but not in upstream/master - # Focus on .github/workflows and other fork-specific paths - git checkout origin/master - FORK_FILES=$(git diff --name-only origin/master upstream/master | grep -E '^\.github/workflows/' || true) + # For each workflow file in fork, check if it exists in upstream + for file in $FORK_WORKFLOWS; do + if ! git cat-file -e upstream/master:"$file" 2>/dev/null; then + echo "Fork-specific file: $file" + # Create directory structure and copy file + mkdir -p "/tmp/fork-specific/$(dirname "$file")" + cp "$file" "/tmp/fork-specific/$file" + fi + done - if [ -z "$FORK_FILES" ]; then - echo "No fork-specific files found." + # Check if any fork-specific files were found + if [ -d "/tmp/fork-specific/.github" ]; then + echo "has_fork_files=true" >> $GITHUB_OUTPUT + echo "Found fork-specific files:" + find /tmp/fork-specific -type f else - echo "Fork-specific files found:" - echo "$FORK_FILES" + echo "has_fork_files=false" >> $GITHUB_OUTPUT + echo "No fork-specific files found" fi - - # Create a temporary branch from upstream/master - echo "Creating new-master branch from upstream/master..." - git checkout -b new-master upstream/master - - # Apply fork-specific changes if any - if [ -n "$FORK_FILES" ]; then - echo "Applying fork-specific changes..." - # Checkout the fork-specific files from origin/master - for file in $FORK_FILES; do - mkdir -p "$(dirname "$file")" - git show origin/master:"$file" > "$file" - git add "$file" - done - - # Create a single squashed commit for all fork-specific changes - if ! git diff --cached --quiet; then - echo "Creating squashed commit for fork-specific changes..." - git commit -m "chore: fork-specific CI and workflow configurations" \ - -m "This commit contains all fork-specific customizations including:" \ - -m "- GitHub Actions workflows" \ - -m "- CI configuration files" \ - -m "- Other fork-specific settings" \ - -m "" \ - -m "These changes are maintained as a single commit to keep the fork" \ - -m "in sync with upstream while preserving fork customizations." - fi + + - name: Reset to upstream master + run: | + # Reset fork master to upstream master + git reset --hard upstream/master + + - name: Restore fork-specific files + if: steps.backup.outputs.has_fork_files == 'true' + run: | + # Copy fork-specific files back + if [ -d "/tmp/fork-specific" ]; then + cp -r /tmp/fork-specific/.github ./ 2>/dev/null || true fi - echo "Force pushing to origin/master..." - git push origin new-master:master --force - - echo "✅ Successfully synced fork with upstream" + # Add all fork-specific changes + git add .github/ + + - name: Commit fork-specific changes + if: steps.backup.outputs.has_fork_files == 'true' + run: | + # Check if there are changes to commit + if ! git diff --cached --quiet; then + git commit -m "Fork-specific CI and workflow configurations" + echo "✅ Fork-specific changes committed" + else + echo "ℹ️ No fork-specific changes to commit" + fi + + - name: Push to fork master + run: | + git push --force origin master + echo "✅ Successfully synced with upstream" sync-manual: - name: Sync Fork with Upstream (Manual) + name: Sync Fork (Manual) if: | github.event_name == 'issue_comment' && - (github.event.issue.pull_request != null || github.event_name == 'issue_comment') && contains(github.event.comment.body, '/sync-upstream') runs-on: ubuntu-latest permissions: contents: write issues: write - pull-requests: write steps: - - name: Check if user is authorized - id: check-auth - uses: actions/github-script@v7 + - name: Check user permission + id: check + uses: actions/github-script@v8 with: + result-encoding: string script: | - const author_association = context.payload.comment.author_association; - const authorized = ['OWNER', 'MEMBER', 'COLLABORATOR'].includes(author_association); + const authorAssociation = context.payload.comment.author_association; + const allowedRoles = ['OWNER', 'MEMBER', 'COLLABORATOR']; - if (!authorized) { - await github.rest.issues.createComment({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: `@${context.payload.comment.user.login} ❌ Only repository owners, members, and collaborators can trigger the sync.` - }); - core.setFailed('User not authorized to trigger sync'); + if (allowedRoles.includes(authorAssociation)) { + return 'true'; + } else { + return 'false'; } + + - name: Add unauthorized reaction + if: steps.check.outputs.result != 'true' + uses: actions/github-script@v8 + with: + script: | + github.rest.reactions.createForIssueComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: context.payload.comment.id, + content: '-1' + }); - return authorized; + github.rest.issues.createComment({ + owner: context.repo.owner, + repo: context.repo.repo, + issue_number: context.issue.number, + body: '❌ Only repository collaborators can trigger the sync.' + }); - - name: Add rocket reaction to acknowledge command - if: steps.check-auth.outputs.result == 'true' - uses: actions/github-script@v7 + - name: Exit if unauthorized + if: steps.check.outputs.result != 'true' + run: exit 1 + + - name: Add rocket reaction + uses: actions/github-script@v8 with: script: | github.rest.reactions.createForIssueComment({ @@ -146,161 +155,135 @@ jobs: content: 'rocket' }); - - name: Checkout master branch - if: steps.check-auth.outputs.result == 'true' + - name: Checkout fork master uses: actions/checkout@v4 with: ref: master - token: ${{ secrets.GITHUB_TOKEN }} fetch-depth: 0 + token: ${{ secrets.GITHUB_TOKEN }} - name: Configure Git - if: steps.check-auth.outputs.result == 'true' run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" - - name: Sync with upstream and squash fork-specific commits - if: steps.check-auth.outputs.result == 'true' - id: sync + - name: Add upstream remote run: | - set -e - - echo "Adding upstream remote..." - git remote add upstream https://github.com/eclipse-jdt/eclipse.jdt.debug.git || true - - echo "Fetching from upstream and origin..." + git remote add upstream https://github.com/eclipse-jdt/eclipse.jdt.debug.git git fetch upstream master - git fetch origin master - - echo "Identifying fork-specific files..." - # Get list of files that exist in origin/master but not in upstream/master - # Focus on .github/workflows and other fork-specific paths - git checkout origin/master - FORK_FILES=$(git diff --name-only origin/master upstream/master | grep -E '^\.github/workflows/' || true) - - if [ -z "$FORK_FILES" ]; then - echo "No fork-specific files found. Nothing to sync." - echo "sync_needed=false" >> $GITHUB_OUTPUT - exit 0 - fi + + - name: Identify and backup fork-specific files + id: backup + run: | + # Create temporary directory for fork-specific files + mkdir -p /tmp/fork-specific - echo "Fork-specific files found:" - echo "$FORK_FILES" - echo "sync_needed=true" >> $GITHUB_OUTPUT + # Identify fork-specific workflow files (files that don't exist in upstream) + git fetch upstream master - # Create a temporary branch from upstream/master - echo "Creating new-master branch from upstream/master..." - git checkout -b new-master upstream/master + # Get list of workflow files in fork + FORK_WORKFLOWS=$(git ls-tree -r HEAD --name-only .github/workflows/ 2>/dev/null || echo "") - # Apply fork-specific changes - echo "Applying fork-specific changes..." - # Checkout the fork-specific files from origin/master - for file in $FORK_FILES; do - mkdir -p "$(dirname "$file")" - git show origin/master:"$file" > "$file" - git add "$file" + # For each workflow file in fork, check if it exists in upstream + for file in $FORK_WORKFLOWS; do + if ! git cat-file -e upstream/master:"$file" 2>/dev/null; then + echo "Fork-specific file: $file" + # Create directory structure and copy file + mkdir -p "/tmp/fork-specific/$(dirname "$file")" + cp "$file" "/tmp/fork-specific/$file" + fi done - # Create a single squashed commit for all fork-specific changes - if git diff --cached --quiet; then - echo "No changes to commit" - echo "sync_needed=false" >> $GITHUB_OUTPUT + # Check if any fork-specific files were found + if [ -d "/tmp/fork-specific/.github" ]; then + echo "has_fork_files=true" >> $GITHUB_OUTPUT + echo "Found fork-specific files:" + find /tmp/fork-specific -type f else - echo "Creating squashed commit for fork-specific changes..." - git commit -m "chore: fork-specific CI and workflow configurations" \ - -m "This commit contains all fork-specific customizations including:" \ - -m "- GitHub Actions workflows" \ - -m "- CI configuration files" \ - -m "- Other fork-specific settings" \ - -m "" \ - -m "These changes are maintained as a single commit to keep the fork" \ - -m "in sync with upstream while preserving fork customizations." - - echo "Force pushing to origin/master..." - git push origin new-master:master --force - - echo "✅ Successfully synced fork with upstream" + echo "has_fork_files=false" >> $GITHUB_OUTPUT + echo "No fork-specific files found" + fi + + - name: Reset to upstream master + id: reset + run: | + # Reset fork master to upstream master + git reset --hard upstream/master + echo "success=true" >> $GITHUB_OUTPUT + + - name: Restore fork-specific files + if: steps.backup.outputs.has_fork_files == 'true' + run: | + # Copy fork-specific files back + if [ -d "/tmp/fork-specific" ]; then + cp -r /tmp/fork-specific/.github ./ 2>/dev/null || true + fi + + # Add all fork-specific changes + git add .github/ + + - name: Commit fork-specific changes + if: steps.backup.outputs.has_fork_files == 'true' + run: | + # Check if there are changes to commit + if ! git diff --cached --quiet; then + git commit -m "Fork-specific CI and workflow configurations" + echo "✅ Fork-specific changes committed" + else + echo "ℹ️ No fork-specific changes to commit" + fi + + - name: Push to fork master + id: push + run: | + if git push --force origin master; then + echo "success=true" >> $GITHUB_OUTPUT + else + echo "success=false" >> $GITHUB_OUTPUT fi - name: Add success comment - if: steps.check-auth.outputs.result == 'true' && steps.sync.outputs.sync_needed == 'true' && success() - uses: actions/github-script@v7 + if: steps.push.outputs.success == 'true' + uses: actions/github-script@v8 with: script: | - await github.rest.reactions.createForIssueComment({ + github.rest.reactions.createForIssueComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: context.payload.comment.id, content: '+1' }); - const body = '✅ Successfully synced fork with `eclipse-jdt/eclipse.jdt.debug:master`\n\n' + - 'The fork\'s master branch has been updated to match upstream, with all fork-specific changes squashed into a single commit.'; - - await github.rest.issues.createComment({ - issue_number: context.issue.number, + github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, - body: body - }); - - - name: Add no-sync-needed comment - if: steps.check-auth.outputs.result == 'true' && steps.sync.outputs.sync_needed == 'false' && success() - uses: actions/github-script@v7 - with: - script: | - const body = 'ℹ️ Fork is already in sync with `eclipse-jdt/eclipse.jdt.debug:master`\n\n' + - 'No sync was needed.'; - - await github.rest.issues.createComment({ issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - body: body + body: '✅ Successfully synced fork master with `eclipse-jdt/eclipse.jdt.debug:master`' }); - name: Add failure comment - if: steps.check-auth.outputs.result == 'true' && failure() - uses: actions/github-script@v7 + if: steps.push.outputs.success == 'false' + uses: actions/github-script@v8 with: script: | - await github.rest.reactions.createForIssueComment({ + github.rest.reactions.createForIssueComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: context.payload.comment.id, content: '-1' }); - const body = '❌ Sync with upstream failed.\n\n' + - '**To sync manually:**\n' + - '```bash\n' + - 'git remote add upstream https://github.com/eclipse-jdt/eclipse.jdt.debug.git\n' + - 'git fetch upstream master\n' + - 'git fetch origin master\n' + - '\n' + - '# Identify fork-specific files (typically in .github/workflows/)\n' + - 'git diff --name-only origin/master upstream/master | grep ".github/workflows/"\n' + - '\n' + - '# Create a branch from upstream\n' + - 'git checkout -b new-master upstream/master\n' + - '\n' + - '# Apply fork-specific files (adjust path as needed)\n' + - 'git checkout origin/master -- .github/workflows/\n' + - '\n' + - '# Commit changes\n' + - 'git add .\n' + - 'git commit -m "Fork-specific CI and workflow configurations"\n' + - '\n' + - '# Force push to master\n' + - 'git push origin new-master:master --force\n' + - '```\n' + - '\n' + - '[View workflow logs](' + context.payload.repository.html_url + '/actions/runs/' + context.runId + ')'; + const comment = `❌ Sync failed. Please check the workflow logs for details. - await github.rest.issues.createComment({ - issue_number: context.issue.number, + [View workflow run](${context.payload.repository.html_url}/actions/runs/${context.runId})`; + + github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, - body: body + issue_number: context.issue.number, + body: comment }); + + - name: Fail workflow if push failed + if: steps.push.outputs.success == 'false' + run: exit 1 From 2b22e84a2e9a3e999539177d5145bbaa820e223e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 15:29:18 +0000 Subject: [PATCH 3/7] Address code review feedback: add error handling and await keywords Co-authored-by: carstenartur <3164220+carstenartur@users.noreply.github.com> --- .github/workflows/sync-upstream.yml | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index fd132c8621..6cfd266e24 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -29,7 +29,7 @@ jobs: - name: Add upstream remote run: | - git remote add upstream https://github.com/eclipse-jdt/eclipse.jdt.debug.git + git remote add upstream https://github.com/eclipse-jdt/eclipse.jdt.debug.git || true git fetch upstream master - name: Identify and backup fork-specific files @@ -38,9 +38,6 @@ jobs: # Create temporary directory for fork-specific files mkdir -p /tmp/fork-specific - # Identify fork-specific workflow files (files that don't exist in upstream) - git fetch upstream master - # Get list of workflow files in fork FORK_WORKFLOWS=$(git ls-tree -r HEAD --name-only .github/workflows/ 2>/dev/null || echo "") @@ -169,7 +166,7 @@ jobs: - name: Add upstream remote run: | - git remote add upstream https://github.com/eclipse-jdt/eclipse.jdt.debug.git + git remote add upstream https://github.com/eclipse-jdt/eclipse.jdt.debug.git || true git fetch upstream master - name: Identify and backup fork-specific files @@ -178,9 +175,6 @@ jobs: # Create temporary directory for fork-specific files mkdir -p /tmp/fork-specific - # Identify fork-specific workflow files (files that don't exist in upstream) - git fetch upstream master - # Get list of workflow files in fork FORK_WORKFLOWS=$(git ls-tree -r HEAD --name-only .github/workflows/ 2>/dev/null || echo "") @@ -247,14 +241,14 @@ jobs: uses: actions/github-script@v8 with: script: | - github.rest.reactions.createForIssueComment({ + await github.rest.reactions.createForIssueComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: context.payload.comment.id, content: '+1' }); - github.rest.issues.createComment({ + await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, @@ -266,7 +260,7 @@ jobs: uses: actions/github-script@v8 with: script: | - github.rest.reactions.createForIssueComment({ + await github.rest.reactions.createForIssueComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: context.payload.comment.id, @@ -277,7 +271,7 @@ jobs: [View workflow run](${context.payload.repository.html_url}/actions/runs/${context.runId})`; - github.rest.issues.createComment({ + await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, From 0206a7bceeaa9d065677630b11ae6e18effa4873 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 15:31:27 +0000 Subject: [PATCH 4/7] Expand workflow to handle ALL fork-specific files, not just workflows Co-authored-by: carstenartur <3164220+carstenartur@users.noreply.github.com> --- .github/workflows/sync-upstream.yml | 32 ++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 6cfd266e24..b3ec1799ce 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -38,11 +38,11 @@ jobs: # Create temporary directory for fork-specific files mkdir -p /tmp/fork-specific - # Get list of workflow files in fork - FORK_WORKFLOWS=$(git ls-tree -r HEAD --name-only .github/workflows/ 2>/dev/null || echo "") + # Get list of all files in fork + ALL_FORK_FILES=$(git ls-tree -r HEAD --name-only 2>/dev/null || echo "") - # For each workflow file in fork, check if it exists in upstream - for file in $FORK_WORKFLOWS; do + # For each file in fork, check if it exists in upstream + for file in $ALL_FORK_FILES; do if ! git cat-file -e upstream/master:"$file" 2>/dev/null; then echo "Fork-specific file: $file" # Create directory structure and copy file @@ -52,7 +52,7 @@ jobs: done # Check if any fork-specific files were found - if [ -d "/tmp/fork-specific/.github" ]; then + if [ -d "/tmp/fork-specific" ] && [ "$(find /tmp/fork-specific -type f)" ]; then echo "has_fork_files=true" >> $GITHUB_OUTPUT echo "Found fork-specific files:" find /tmp/fork-specific -type f @@ -69,13 +69,13 @@ jobs: - name: Restore fork-specific files if: steps.backup.outputs.has_fork_files == 'true' run: | - # Copy fork-specific files back + # Copy all fork-specific files back if [ -d "/tmp/fork-specific" ]; then - cp -r /tmp/fork-specific/.github ./ 2>/dev/null || true + cp -r /tmp/fork-specific/* ./ 2>/dev/null || true fi # Add all fork-specific changes - git add .github/ + git add . - name: Commit fork-specific changes if: steps.backup.outputs.has_fork_files == 'true' @@ -175,11 +175,11 @@ jobs: # Create temporary directory for fork-specific files mkdir -p /tmp/fork-specific - # Get list of workflow files in fork - FORK_WORKFLOWS=$(git ls-tree -r HEAD --name-only .github/workflows/ 2>/dev/null || echo "") + # Get list of all files in fork + ALL_FORK_FILES=$(git ls-tree -r HEAD --name-only 2>/dev/null || echo "") - # For each workflow file in fork, check if it exists in upstream - for file in $FORK_WORKFLOWS; do + # For each file in fork, check if it exists in upstream + for file in $ALL_FORK_FILES; do if ! git cat-file -e upstream/master:"$file" 2>/dev/null; then echo "Fork-specific file: $file" # Create directory structure and copy file @@ -189,7 +189,7 @@ jobs: done # Check if any fork-specific files were found - if [ -d "/tmp/fork-specific/.github" ]; then + if [ -d "/tmp/fork-specific" ] && [ "$(find /tmp/fork-specific -type f)" ]; then echo "has_fork_files=true" >> $GITHUB_OUTPUT echo "Found fork-specific files:" find /tmp/fork-specific -type f @@ -208,13 +208,13 @@ jobs: - name: Restore fork-specific files if: steps.backup.outputs.has_fork_files == 'true' run: | - # Copy fork-specific files back + # Copy all fork-specific files back if [ -d "/tmp/fork-specific" ]; then - cp -r /tmp/fork-specific/.github ./ 2>/dev/null || true + cp -r /tmp/fork-specific/* ./ 2>/dev/null || true fi # Add all fork-specific changes - git add .github/ + git add . - name: Commit fork-specific changes if: steps.backup.outputs.has_fork_files == 'true' From cc764960272b25b5e0a4cdf0964815c8e7640e9f Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 15:33:09 +0000 Subject: [PATCH 5/7] Address final code review issues: improve variable naming and error handling Co-authored-by: carstenartur <3164220+carstenartur@users.noreply.github.com> --- .github/workflows/sync-upstream.yml | 42 ++++++++++++++--------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index b3ec1799ce..06c69e061d 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -38,11 +38,11 @@ jobs: # Create temporary directory for fork-specific files mkdir -p /tmp/fork-specific - # Get list of all files in fork - ALL_FORK_FILES=$(git ls-tree -r HEAD --name-only 2>/dev/null || echo "") + # Get list of all files in fork (filtering for fork-specific happens in the loop) + ALL_FILES=$(git ls-tree -r HEAD --name-only 2>/dev/null || echo "") # For each file in fork, check if it exists in upstream - for file in $ALL_FORK_FILES; do + for file in $ALL_FILES; do if ! git cat-file -e upstream/master:"$file" 2>/dev/null; then echo "Fork-specific file: $file" # Create directory structure and copy file @@ -52,7 +52,7 @@ jobs: done # Check if any fork-specific files were found - if [ -d "/tmp/fork-specific" ] && [ "$(find /tmp/fork-specific -type f)" ]; then + if [ -d "/tmp/fork-specific" ] && [ -n "$(find /tmp/fork-specific -type f)" ]; then echo "has_fork_files=true" >> $GITHUB_OUTPUT echo "Found fork-specific files:" find /tmp/fork-specific -type f @@ -175,11 +175,11 @@ jobs: # Create temporary directory for fork-specific files mkdir -p /tmp/fork-specific - # Get list of all files in fork - ALL_FORK_FILES=$(git ls-tree -r HEAD --name-only 2>/dev/null || echo "") + # Get list of all files in fork (filtering for fork-specific happens in the loop) + ALL_FILES=$(git ls-tree -r HEAD --name-only 2>/dev/null || echo "") # For each file in fork, check if it exists in upstream - for file in $ALL_FORK_FILES; do + for file in $ALL_FILES; do if ! git cat-file -e upstream/master:"$file" 2>/dev/null; then echo "Fork-specific file: $file" # Create directory structure and copy file @@ -189,7 +189,7 @@ jobs: done # Check if any fork-specific files were found - if [ -d "/tmp/fork-specific" ] && [ "$(find /tmp/fork-specific -type f)" ]; then + if [ -d "/tmp/fork-specific" ] && [ -n "$(find /tmp/fork-specific -type f)" ]; then echo "has_fork_files=true" >> $GITHUB_OUTPUT echo "Found fork-specific files:" find /tmp/fork-specific -type f @@ -241,18 +241,18 @@ jobs: uses: actions/github-script@v8 with: script: | - await github.rest.reactions.createForIssueComment({ + await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, - comment_id: context.payload.comment.id, - content: '+1' + issue_number: context.issue.number, + body: '✅ Successfully synced fork master with `eclipse-jdt/eclipse.jdt.debug:master`' }); - await github.rest.issues.createComment({ + await github.rest.reactions.createForIssueComment({ owner: context.repo.owner, repo: context.repo.repo, - issue_number: context.issue.number, - body: '✅ Successfully synced fork master with `eclipse-jdt/eclipse.jdt.debug:master`' + comment_id: context.payload.comment.id, + content: '+1' }); - name: Add failure comment @@ -260,13 +260,6 @@ jobs: uses: actions/github-script@v8 with: script: | - await github.rest.reactions.createForIssueComment({ - owner: context.repo.owner, - repo: context.repo.repo, - comment_id: context.payload.comment.id, - content: '-1' - }); - const comment = `❌ Sync failed. Please check the workflow logs for details. [View workflow run](${context.payload.repository.html_url}/actions/runs/${context.runId})`; @@ -277,6 +270,13 @@ jobs: issue_number: context.issue.number, body: comment }); + + await github.rest.reactions.createForIssueComment({ + owner: context.repo.owner, + repo: context.repo.repo, + comment_id: context.payload.comment.id, + content: '-1' + }); - name: Fail workflow if push failed if: steps.push.outputs.success == 'false' From 6baea3106cb81c87f0fb361768cff0a5063aeea5 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 15:35:04 +0000 Subject: [PATCH 6/7] Final improvements: better variable naming, commit message, and robust file checking Co-authored-by: carstenartur <3164220+carstenartur@users.noreply.github.com> --- .github/workflows/sync-upstream.yml | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 06c69e061d..4240642f63 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -38,11 +38,11 @@ jobs: # Create temporary directory for fork-specific files mkdir -p /tmp/fork-specific - # Get list of all files in fork (filtering for fork-specific happens in the loop) - ALL_FILES=$(git ls-tree -r HEAD --name-only 2>/dev/null || echo "") + # Get list of all files in current branch + FILES_TO_CHECK=$(git ls-tree -r HEAD --name-only 2>/dev/null || echo "") - # For each file in fork, check if it exists in upstream - for file in $ALL_FILES; do + # For each file in fork, check if it exists in upstream (files that don't = fork-specific) + for file in $FILES_TO_CHECK; do if ! git cat-file -e upstream/master:"$file" 2>/dev/null; then echo "Fork-specific file: $file" # Create directory structure and copy file @@ -52,7 +52,7 @@ jobs: done # Check if any fork-specific files were found - if [ -d "/tmp/fork-specific" ] && [ -n "$(find /tmp/fork-specific -type f)" ]; then + if [ -d "/tmp/fork-specific" ] && find /tmp/fork-specific -type f -print -quit | grep -q .; then echo "has_fork_files=true" >> $GITHUB_OUTPUT echo "Found fork-specific files:" find /tmp/fork-specific -type f @@ -95,9 +95,7 @@ jobs: sync-manual: name: Sync Fork (Manual) - if: | - github.event_name == 'issue_comment' && - contains(github.event.comment.body, '/sync-upstream') + if: contains(github.event.comment.body, '/sync-upstream') runs-on: ubuntu-latest permissions: contents: write @@ -175,11 +173,11 @@ jobs: # Create temporary directory for fork-specific files mkdir -p /tmp/fork-specific - # Get list of all files in fork (filtering for fork-specific happens in the loop) - ALL_FILES=$(git ls-tree -r HEAD --name-only 2>/dev/null || echo "") + # Get list of all files in current branch + FILES_TO_CHECK=$(git ls-tree -r HEAD --name-only 2>/dev/null || echo "") - # For each file in fork, check if it exists in upstream - for file in $ALL_FILES; do + # For each file in fork, check if it exists in upstream (files that don't = fork-specific) + for file in $FILES_TO_CHECK; do if ! git cat-file -e upstream/master:"$file" 2>/dev/null; then echo "Fork-specific file: $file" # Create directory structure and copy file @@ -189,7 +187,7 @@ jobs: done # Check if any fork-specific files were found - if [ -d "/tmp/fork-specific" ] && [ -n "$(find /tmp/fork-specific -type f)" ]; then + if [ -d "/tmp/fork-specific" ] && find /tmp/fork-specific -type f -print -quit | grep -q .; then echo "has_fork_files=true" >> $GITHUB_OUTPUT echo "Found fork-specific files:" find /tmp/fork-specific -type f @@ -221,7 +219,7 @@ jobs: run: | # Check if there are changes to commit if ! git diff --cached --quiet; then - git commit -m "Fork-specific CI and workflow configurations" + git commit -m "Fork-specific customizations" echo "✅ Fork-specific changes committed" else echo "ℹ️ No fork-specific changes to commit" From c810890feb1dd75386fac52e0d0ad9cbef65e71e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Fri, 13 Feb 2026 15:36:00 +0000 Subject: [PATCH 7/7] Fix remaining inconsistencies: add missing await keywords and fix commit message Co-authored-by: carstenartur <3164220+carstenartur@users.noreply.github.com> --- .github/workflows/sync-upstream.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/sync-upstream.yml b/.github/workflows/sync-upstream.yml index 4240642f63..c9a71b9d45 100644 --- a/.github/workflows/sync-upstream.yml +++ b/.github/workflows/sync-upstream.yml @@ -82,7 +82,7 @@ jobs: run: | # Check if there are changes to commit if ! git diff --cached --quiet; then - git commit -m "Fork-specific CI and workflow configurations" + git commit -m "Fork-specific customizations" echo "✅ Fork-specific changes committed" else echo "ℹ️ No fork-specific changes to commit" @@ -121,14 +121,14 @@ jobs: uses: actions/github-script@v8 with: script: | - github.rest.reactions.createForIssueComment({ + await github.rest.reactions.createForIssueComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: context.payload.comment.id, content: '-1' }); - github.rest.issues.createComment({ + await github.rest.issues.createComment({ owner: context.repo.owner, repo: context.repo.repo, issue_number: context.issue.number, @@ -143,7 +143,7 @@ jobs: uses: actions/github-script@v8 with: script: | - github.rest.reactions.createForIssueComment({ + await github.rest.reactions.createForIssueComment({ owner: context.repo.owner, repo: context.repo.repo, comment_id: context.payload.comment.id,