Skip to content

Add fork-build.yml workflow to prevent sync conflicts#78

Merged
carstenartur merged 2 commits into
masterfrom
copilot/add-fork-build-workflow
Feb 5, 2026
Merged

Add fork-build.yml workflow to prevent sync conflicts#78
carstenartur merged 2 commits into
masterfrom
copilot/add-fork-build-workflow

Conversation

Copilot AI commented Feb 5, 2026

Copy link
Copy Markdown

The sync-upstream workflow overwrites codeql.yml because it only preserves files absent from upstream, not files with divergent content. Fork's version contains full Maven build + CodeQL analysis; upstream's is a minimal stub.

Changes

  • Created .github/workflows/fork-build.yml: Extracted fork-specific build logic into a uniquely-named workflow file
    • Maven build with -Pbuild-individual-bundles profile
    • CodeQL initialization and analysis
    • Triggers: push/PR to master, scheduled Tuesday 9:20 AM UTC
    • Java 21 / Maven 3.9.9

Since fork-build.yml doesn't exist in upstream, the existing sync-upstream backup logic will automatically preserve it during syncs. No changes to sync-upstream.yml required.

jobs:
  build:
    steps:
    - name: Initialize CodeQL
      uses: github/codeql-action/init@v3
    - name: Build with Maven
      run: mvn -B package -Pbuild-individual-bundles --file pom.xml
    - name: Perform CodeQL Analysis
      uses: github/codeql-action/analyze@v3
Original prompt

Problem

The sync-upstream workflow overwrites fork-specific workflow content when syncing with upstream. Specifically, the codeql.yml file exists in both the fork and upstream, but with different content - the fork's version has a full Maven build and CodeQL analysis, while upstream has a minimal stub. When syncing, the fork version gets overwritten because the backup logic only preserves files that don't exist in upstream, not files with different content.

Solution

  1. Create a new file .github/workflows/fork-build.yml - Move the fork-specific build logic (Maven build with CodeQL analysis) into a new workflow file that doesn't conflict with upstream's codeql.yml. This new file should:
    • Be named fork-build.yml (or similar unique name that won't conflict with upstream)
    • Contain the full build workflow from the old codeql.yml (the analyze job with Maven build)
    • Trigger on push to master, pull requests to master, and on a schedule
    • Use the same Java 21, Maven 3.9.9 setup
    • Run mvn -B package -Pbuild-individual-bundles --file pom.xml
    • This provides the green checkmark build status

Here is the content to extract from the old codeql.yml into the new fork-build.yml (keep the CodeQL analysis parts but make it a standalone build workflow):

name: "Fork Build"

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]
  schedule:
    - cron: '20 9 * * 2'

jobs:
  build:
    name: Build
    runs-on: ubuntu-latest
    permissions:
      actions: read
      contents: read
      security-events: write

    strategy:
      fail-fast: false
      matrix:
        language: [ 'java' ]

    steps:
    - name: Checkout repository
      uses: actions/checkout@v4
    - name: Set up Maven
      uses: stCarolas/setup-maven@d6af6abeda15e98926a57b5aa970a96bb37f97d1 # v5
      with:
        maven-version: 3.9.9
    - name: Setup Java JDK
      uses: actions/setup-java@v4
      with:
        distribution: 'temurin'
        java-version: '21' 

    - name: Initialize CodeQL
      uses: github/codeql-action/init@v3
      with:
        languages: ${{ matrix.language }}

    - name: Build with Maven
      run: mvn -B package -Pbuild-individual-bundles --file pom.xml

    - name: Perform CodeQL Analysis
      uses: github/codeql-action/analyze@v3
      env:
        CODEQL_ACTION_EXTRA_OPTIONS: '{"database":{"interpret-results":["--max-paths", 1]}}'
  1. Update .github/workflows/sync-upstream.yml - Add fork-build.yml to the list of files that are always preserved during sync. The current logic already handles files that don't exist in upstream, so fork-build.yml will automatically be preserved.

This solution:

  • Creates a new workflow file with a unique name that won't conflict with upstream
  • The sync-upstream workflow will automatically preserve it (since it doesn't exist in upstream)
  • Restores the green checkmark build status on master
  • Prevents future conflicts when syncing with upstream

This pull request was created from Copilot chat.


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

…lysis

Co-authored-by: carstenartur <3164220+carstenartur@users.noreply.github.com>
Copilot AI changed the title [WIP] Add fork-specific build workflow to prevent data loss Add fork-build.yml workflow to prevent sync conflicts Feb 5, 2026
Copilot AI requested a review from carstenartur February 5, 2026 05:05
@carstenartur carstenartur marked this pull request as ready for review February 5, 2026 05:36
@carstenartur carstenartur merged commit 7b48c36 into master Feb 5, 2026
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants