Skip to content

ci: auto-commit generated supply-chain files to fix dry-run failures - #858

Closed
HappyCoding-2025 with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-ci-job-uncommitted-changes
Closed

HappyCoding-2025 with Copilot wants to merge 2 commits into
mainfrom
copilot/fix-ci-job-uncommitted-changes

Conversation

Copilot AI commented Oct 10, 2025 •

Copy link
Copy Markdown

Problem

The CI workflow was failing during the "Crate Release Dry Run" step due to uncommitted changes in supply-chain/audits.toml and supply-chain/imports.lock. These files are automatically regenerated by cargo-vet during CI runs, but the local developer's tree is clean because the files haven't been committed yet.

Failing CI Job Reference:

Solution

This PR modifies .github/workflows/CiWorkflow.yml to automatically commit and push regenerated supply-chain files back to the branch after running cargo-vet.

Changes Made

  1. Enhanced checkout configuration (lines 68-71):

    - name: ✅ Checkout Repository ✅
      uses: actions/checkout@v4
      with:
        fetch-depth: 0
        persist-credentials: true
    • fetch-depth: 0 provides full git history for accurate diffs
    • persist-credentials: true enables git push using the preconfigured GITHUB_TOKEN
  2. Added auto-commit step (lines 100-111):

    - name: Commit generated supply-chain files
      if: github.actor != 'github-actions[bot]' && runner.os == 'Linux'
      run: |
        git config user.name "github-actions[bot]"
        git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
        git add -A supply-chain || true
        if ! git diff --cached --quiet; then
          git commit -m "ci: update generated supply-chain files [skip ci]"
          git push origin HEAD:${{ github.ref_name }}
        else
          echo "No generated supply-chain changes to commit."
        fi

Safety Mechanisms

  • Actor guard (github.actor != 'github-actions[bot]'): Prevents infinite CI loops when the automated commit triggers another workflow run
  • Linux-only execution (runner.os == 'Linux'): Prevents race conditions from multiple OS matrix runners attempting to push simultaneously
  • Skip CI marker ([skip ci] in commit message): Provides an additional safeguard for workflows that respect this convention
  • Conditional commit: Only commits and pushes if there are actual changes to the supply-chain directory

Impact

  • Developers no longer need to manually commit regenerated supply-chain files
  • CI dry-run checks will pass even when supply-chain files are updated by cargo-vet
  • The workflow remains safe from infinite loops and race conditions
  • Minimal changes to the CI workflow (only 16 lines added)
Original prompt

There is a failing CI job due to uncommitted changes in supply-chain/audits.toml and supply-chain/imports.lock (run: https://github.com/OpenDevicePartnership/patina/actions/runs/18413307399/job/52471035730?pr=855, ref: 4559192). The local developer's tree is clean; the CI should automatically commit regenerated supply-chain files to avoid dry-run failures.

Make the following edits to .github/workflows/ci-workflow.yml at ref 4559192:

  1. Ensure checkout allows pushes and full history by updating the actions/checkout step to include:

uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: true

  1. Add a new step after the step that can modify files under supply-chain/ to commit and push only when files changed. The step must:
  • Run only when github.actor != 'github-actions[bot]' to avoid workflow loops.
  • Stage only supply-chain changes.
  • Commit with message: "ci: update generated supply-chain files [skip ci]".
  • Push back to the same branch using the preconfigured GITHUB_TOKEN.

Suggested YAML to insert (adjust placement so it runs after the file-generation step):

  • name: Commit generated supply-chain files
    if: github.actor != 'github-actions[bot]'
    run: |
    git config user.name "github-actions[bot]"
    git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
    git add -A supply-chain || true
    if ! git diff --cached --quiet; then
    git commit -m "ci: update generated supply-chain files [skip ci]"
    git push origin HEAD:${{ github.ref_name }}
    else
    echo "No generated supply-chain changes to commit."
    fi

Notes and rationale to include in PR description:

  • fetch-depth: 0 is required for full history and accurate diffs.
  • persist-credentials: true lets git use GITHUB_TOKEN for pushing.
  • The actor guard prevents infinite CI loops when the push triggers another workflow run.
  • The commit message includes [skip ci] as an additional safeguard (some workflows respect it).

Please create a new branch, apply the changes to .github/workflows/ci-workflow.yml, and open a pull request with the title above. Include the failing job link and ref 4559192 in the PR description for traceability.

Do not merge the PR automatically.

This pull request was created as a result of the following prompt from Copilot chat.

There is a failing CI job due to uncommitted changes in supply-chain/audits.toml and supply-chain/imports.lock (run: https://github.com/OpenDevicePartnership/patina/actions/runs/18413307399/job/52471035730?pr=855, ref: 4559192). The local developer's tree is clean; the CI should automatically commit regenerated supply-chain files to avoid dry-run failures.

Make the following edits to .github/workflows/ci-workflow.yml at ref 4559192:

  1. Ensure checkout allows pushes and full history by updating the actions/checkout step to include:

uses: actions/checkout@v4
with:
fetch-depth: 0
persist-credentials: true

  1. Add a new step after the step that can modify files under supply-chain/ to commit and push only when files changed. The step must:
  • Run only when github.actor != 'github-actions[bot]' to avoid workflow loops.
  • Stage only supply-chain changes.
  • Commit with message: "ci: update generated supply-chain files [skip ci]".
  • Push back to the same branch using the preconfigured GITHUB_TOKEN.

Suggested YAML to insert (adjust placement so it runs after the file-generation step):

  • name: Commit generated supply-chain files
    if: github.actor != 'github-actions[bot]'
    run: |
    git config user.name "github-actions[bot]"
    git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
    git add -A supply-chain || true
    if ! git diff --cached --quiet; then
    git commit -m "ci: update generated supply-chain files [skip ci]"
    git push origin HEAD:${{ github.ref_name }}
    else
    echo "No generated supply-chain changes to commit."
    fi

Notes and rationale to include in PR description:

  • fetch-depth: 0 is required for full history and accurate diffs.
  • persist-credentials: true lets git use GITHUB_TOKEN for pushing.
  • The actor guard prevents infinite CI loops when the push triggers another workflow run.
  • The commit message includes [skip ci] as an additional safeguard (some workflows respect it).

Please create a new branch, apply the changes to .github/workflows/ci-workflow.yml, and open a pull request with the title above. Include the failing job link and ref 4559192 in the PR description for traceability.

Do not merge the PR automatically.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot wasn't able to review any files in this pull request.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: HappyCoding-2025 <190552759+HappyCoding-2025@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix CI job to handle uncommitted changes in supply-chain files ci: auto-commit generated supply-chain files to fix dry-run failures Oct 10, 2025
@Javagedes

Copy link
Copy Markdown
Contributor

CI workflows should absolutely not commit any files to a branch. If there are crates that have been updated and not properly reviewed, which causes cargo vet to fail, they need to be manually reviewed and approved.

Auto allowing the failing crates is just as bad as not checking at all.

We need to do some review of how applicable cargo vet is to this crate, I agree. We have hit ~4 crates in 2 days. However this is not the solution.

@HappyCoding-2025 HappyCoding-2025 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dry run error is not visible in local repo to fix this. Help pointed to this fix.

@HappyCoding-2025

Copy link
Copy Markdown
Contributor

@Javagedes - Please advise - I am not seeing this issue at my system at all . How do i resolve this. I will check with you on teams.
THanks a lot for reviewing this!

@makubacki makubacki left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot accept auto committed changes and we currently do not accept PRs directly submitted by copilot.

@makubacki makubacki closed this Oct 10, 2025
@makubacki
makubacki deleted the copilot/fix-ci-job-uncommitted-changes branch February 26, 2026 16:12
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.

5 participants