Skip to content

Workflow and action maintenance: working-directory, cmake-build skip logic, dependabot robustness, CodeQL suppression#434

Open
greenc-FNAL wants to merge 8 commits intomainfrom
maintenance/steps-use-working-directory
Open

Workflow and action maintenance: working-directory, cmake-build skip logic, dependabot robustness, CodeQL suppression#434
greenc-FNAL wants to merge 8 commits intomainfrom
maintenance/steps-use-working-directory

Conversation

@greenc-FNAL
Copy link
Contributor

@greenc-FNAL greenc-FNAL commented Mar 17, 2026

Changes

Use working-directory: instead of cd in actions and workflows

Replace cd "$GITHUB_WORKSPACE/$BUILD_PATH" (via an env var) with a native
working-directory: key in configure-cmake, build-cmake, cmake-build,
coverage, and clang-tidy-fix. This removes the unnecessary BUILD_PATH env
vars and makes the working directory intent explicit and declarative.

cmake-build.yaml: relevance-check skip logic and messaging

  • generate-matrix and build jobs now gate on
    inputs.skip-relevance-check || needs.setup.outputs.has_changes == 'true' || workflow_dispatch
    so they are correctly skipped when no relevant changes are detected.
  • Add a cmake-build-skipped job that emits a ::notice:: annotation when the
    build is skipped due to no relevant changes, giving clear feedback in the Actions UI.
  • Fix the workflow_dispatch help text: the default combination is gcc/none, not
    "all except clang/none and clang/valgrind".
  • Improve the build-complete comment to say "No relevant C++ or CMake changes
    detected; build skipped" instead of the generic "Build job was skipped".

dependabot-auto-merge.yaml: robustness against two failure modes

  • Repository setting disabled (Auto merge is not allowed for this repository):
    re-enable the allow_auto_merge repository setting via the API and retry once.
    This self-heals accidental toggling in the repository admin UI.
  • Concurrent merge race (Base branch was modified): post @dependabot rebase
    and exit 0. The workflow re-triggers naturally via check_suite:completed once the
    rebased branch passes checks. With N concurrent Dependabot PRs this converges in N−1
    rounds, each round merging one PR and rebasing the remainder.

run-change-detection/action.yaml: suppress inapposite CodeQL alert

Add a # codeql[actions/pull-request-target-injection] suppression directive with an
explanatory comment on the ref: input. This action is never called from a
pull_request_target workflow, and the empty sparse checkout (sparse-checkout: "")
prevents any file from being materialized on disk regardless.

greenc-FNAL and others added 2 commits March 17, 2026 17:06
Replace all uses of `cd "$GITHUB_WORKSPACE/$PATH"` at the start of
`run:` blocks with the idiomatic `working-directory:` step key. This
applies to:

- `.github/actions/build-cmake/action.yaml`: use `working-directory:
  ${{ inputs.build-path }}`; remove now-redundant `BUILD_PATH` and
  unused `SOURCE_PATH` env vars.
- `.github/actions/configure-cmake/action.yaml`: same, remove `BUILD_PATH`
  env var (keep `SOURCE_PATH` which is used to construct `SOURCE_DIR`).
- `.github/workflows/cmake-build.yaml`: apply to Run tests, Run Valgrind
  tests, and Run Perfetto profiling steps; also fix a second bug introduced
  during the rebase where `env.local_build_path` (a job-level env var that
  was dropped when the workflow was refactored to use workflow-setup) was
  still referenced in the Perfetto step and the Upload Perfetto traces
  artifact paths — all replaced with `needs.setup.outputs.build_path`. The
  now-redundant duplicate glob pattern in the artifact path list is also
  removed (pftrace files are already matched by the `**/*.pftrace` pattern).
- `.github/workflows/clang-tidy-fix.yaml`: apply to Apply fixes, Generate
  fixes, and Apply clang-tidy fixes steps; remove the pointless
  `cd "$GITHUB_WORKSPACE"` from Prepare CMake configuration options
  (the step performs only string manipulation, so the cwd is irrelevant).
  For Apply fixes, the `find` search is updated to use an absolute path
  since the working directory is now set to the checkout path.
- `.github/workflows/coverage.yaml`: apply to all six build-path steps.
  The `PROFILE_ROOT` construction in Run tests with coverage is simplified
  from `$GITHUB_WORKSPACE/$BUILD_PATH/test/profraw` to `$(pwd)/test/profraw`,
  eliminating the need for the `BUILD_PATH` env var in that step.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@greenc-FNAL
Copy link
Contributor Author

Review the full CodeQL report for details.

@greenc-FNAL
Copy link
Contributor Author

@phlexbot yaml-fix

@github-actions
Copy link
Contributor

Automatic YAML formatter fixes pushed (commit 947dec9).
⚠️ Note: Some issues may require manual review and fixing.

@codecov
Copy link

codecov bot commented Mar 17, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

@@            Coverage Diff             @@
##             main     #434      +/-   ##
==========================================
- Coverage   84.43%   84.40%   -0.04%     
==========================================
  Files         127      127              
  Lines        3329     3329              
  Branches      564      564              
==========================================
- Hits         2811     2810       -1     
  Misses        325      325              
- Partials      193      194       +1     
Flag Coverage Δ
unittests 84.40% <ø> (-0.04%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.
see 3 files with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6d7eb1a...8908411. Read the comment docs.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@greenc-FNAL greenc-FNAL marked this pull request as ready for review March 18, 2026 13:01
Copilot AI review requested due to automatic review settings March 18, 2026 13:01
@greenc-FNAL greenc-FNAL changed the title [WIP] Workflow QoL improvements Workflow QoL improvements Mar 18, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR focuses on GitHub Actions workflow quality-of-life improvements by standardizing directory handling (moving from cd to working-directory) and refining CMake build workflow skip/messaging behavior.

Changes:

  • Replace cd ... patterns with working-directory: across workflows/composite actions.
  • Adjust cmake-build.yaml relevance-based skip behavior and improve “skipped” messaging.
  • Update build-matrix defaults/available combinations in the matrix generator.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
.github/workflows/coverage.yaml Uses working-directory and relative paths (pwd) for coverage steps.
.github/workflows/cmake-build.yaml Adds relevance-aware gating for matrix/build and introduces an explicit “skipped” job + updated comment messaging.
.github/workflows/clang-tidy-fix.yaml Removes cd usage and makes fix-artifact discovery path explicit.
.github/actions/run-change-detection/action.yaml Adds justification + CodeQL suppression comment around checkout safety.
.github/actions/generate-build-matrix/generate_matrix.py Changes default combinations and adds new perfetto combinations.
.github/actions/configure-cmake/action.yaml Runs configuration directly in build dir via working-directory.
.github/actions/build-cmake/action.yaml Runs builds directly in build dir via working-directory.

You can also share your feedback on Copilot code review. Take the survey.

@greenc-FNAL greenc-FNAL changed the title Workflow QoL improvements Workflow and action maintenance: working-directory, cmake-build skip logic, dependabot robustness, CodeQL suppression Mar 18, 2026
@greenc-FNAL greenc-FNAL requested a review from Copilot March 18, 2026 18:25
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR performs maintenance updates across GitHub workflows and composite actions to make directory handling more declarative, improve CI skip behavior and messaging when no relevant changes are detected, harden Dependabot auto-merge against common failure modes, and suppress an inapposite CodeQL alert for a safe checkout pattern.

Changes:

  • Replace cd ... patterns with working-directory: in several workflows/actions to simplify scripts and reduce reliance on intermediate env vars.
  • Update cmake-build.yaml job gating so matrix generation/build is skipped when relevance detection finds no C++/CMake changes, and add a dedicated “skipped” notice job + clearer PR comment text.
  • Improve dependabot-auto-merge.yaml robustness by auto-remediating a disabled “Allow auto-merge” setting and handling concurrent base-branch updates via @dependabot rebase.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
.github/workflows/dependabot-auto-merge.yaml Adds retry/self-heal logic for auto-merge enablement and handles base-branch race via Dependabot rebase.
.github/workflows/coverage.yaml Uses working-directory and makes coverage paths relative to the build directory.
.github/workflows/cmake-build.yaml Adds skip gating on relevance detection, emits a skip notice job, and improves skip messaging.
.github/workflows/clang-tidy-fix.yaml Uses working-directory and adjusts artifact lookup paths accordingly.
.github/actions/run-change-detection/action.yaml Adds a CodeQL suppression comment for checkout ref input in this composite action.
.github/actions/configure-cmake/action.yaml Switches to working-directory and removes BUILD_PATH env usage.
.github/actions/build-cmake/action.yaml Switches to working-directory and removes cd + unused env vars.

You can also share your feedback on Copilot code review. Take the survey.

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