Skip to content

Commit 3876e62

Browse files
docs: address review comments and finalize markdown workflows
- Add 'md' file type support to detect-relevant-changes action - Enable workflow_call support in markdown-fix.yaml - Pin markdownlint actions to specific SHAs with full version annotations - Ensure all action checkouts use full version numbers in annotations (e.g., v6.0.2) - Unified bot command parsing in markdown-fix.yaml to support @<repo>bot format Co-authored-by: greenc-FNAL <2372949+greenc-FNAL@users.noreply.github.com>
1 parent c9eac14 commit 3876e62

File tree

9 files changed

+60
-74
lines changed

9 files changed

+60
-74
lines changed

.github/CodeQL-README.md

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
```markdown
12
# CodeQL scanning for this repository
23

34
This repository uses C++ (C++20 / moving to C++23) built with CMake under the phlex-src directory, plus some Python and CI bits (Bash). The repository includes a CodeQL GitHub Actions workflow on branch `copilot/codeql-workflow` that:
@@ -8,26 +9,22 @@ This repository uses C++ (C++20 / moving to C++23) built with CMake under the ph
89
- Uses RelWithDebInfo build type in CI so debug symbols are present while keeping realistic optimization.
910

1011
Important workflow-specific notes
11-
1212
- The workflow sets `autobuild: false` during the CodeQL init so the repository's own configure / build steps run. This is intentional: the Phlex build actions are used to build exactly what you ship.
1313
- The workflow tries to locate and copy a compile_commands.json (from `phlex-src/build/` or `phlex-build/`) to the workspace root so diagnostic tools and manual inspection have a predictable path.
1414
- The workflow runs inside the repository container image (if provided) so it uses the same toolchain and environment your CI expects.
1515

1616
How the workflow is targeted at phlex-src
17-
1817
- The CMake configure & build steps are run with `-S phlex-src -B phlex-src/build` (or your Phlex-specific helpers are invoked in that context) so compile units, compiler flags, and generated compile_commands reference files under `phlex-src`.
1918
- The CodeQL config (`.github/codeql/codeql-config.yml`) contains an explicit `paths.include: - phlex-src/**` entry and excludes common vendor/build directories. This ensures CodeQL focuses on the intended code and not third-party or generated artifacts.
2019

2120
Recommended build type for CodeQL runs
22-
2321
- Use RelWithDebInfo (the workflow is already set to use this). Rationale:
2422
- RelWithDebInfo produces debug symbols (required for better mapping of findings to source/stack traces) while compiling with optimizations closer to production.
2523
- Pure Debug (-O0 -g) can be used for local triage of tricky alerts but is slower and sometimes produces analysis results that differ from optimized builds.
2624
- Release (no debug info) is not recommended for CodeQL because missing debug symbols reduce the quality of evidence and traces in findings.
2725

2826
How to run CodeQL locally (examples)
29-
30-
1. Install the CodeQL CLI: <https://codeql.github.com/docs/codeql-cli/getting-started/>
27+
1. Install the CodeQL CLI: https://codeql.github.com/docs/codeql-cli/getting-started/
3128
2. Create a C++ database for the phlex-src tree (example):
3229
- From repository root:
3330
codeql database create codeql-db --language=cpp --command="cmake -S phlex-src -B phlex-src/build -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_EXPORT_COMPILE_COMMANDS=ON && cmake --build phlex-src/build -- -j$(nproc)"
@@ -39,20 +36,17 @@ How to run CodeQL locally (examples)
3936
5. Open the SARIF in VS Code via the CodeQL extension or upload results via the GitHub UI.
4037

4138
Triage tips and workflows
42-
4339
- Start with high-confidence, high-severity alerts.
4440
- Use the evidence shown in the CodeQL alert to locate the vulnerable trace. RelWithDebInfo gives better evidence than Release.
4541
- When marking false positives, add a short rationale in the Code Scanning UI (this helps future auditors).
4642
- If the repo has many historical findings, consider a triage sprint to baseline or create a SARIF baseline to ignore existing alerts temporarily while blocking new ones.
4743

4844
How to add or change query packs
49-
5045
- The repository currently selects the language security-and-quality packs for C++ and Python. That is a good default.
5146
- If you want to add additional packs (experimental or specialized) you can:
5247
- Edit `.github/codeql/codeql-config.yml` and add additional packs there (use the canonical pack name), or
5348
- Add them to the init step in the workflow (`with: queries:`).
5449
- Example of adding packs in the workflow init:
55-
5650
```yaml
5751
uses: github/codeql-action/init@v4
5852
with:
@@ -65,14 +59,12 @@ How to add or change query packs
6559
```
6660
6761
Action-specific / workflow scanning
68-
6962
- There are CodeQL query packs that specifically analyze GitHub Actions workflow files (YAML) to find insecure patterns (for example: unsafe use of secrets, untrusted inputs in workflow run steps, usage of unpinned actions, etc.). If you rely on custom workflows or pass secrets/inputs to actions, consider enabling the GitHub Actions query pack if it is available in your CodeQL pack index.
7063
- To discover whether an official GitHub Actions pack exists or to find its exact name, see the CodeQL packs index (the canonical source) or search the public CodeQL repository:
71-
- <https://github.com/github/codeql/tree/main/packs>
64+
- https://github.com/github/codeql/tree/main/packs
7265
- Search for "github-actions" or "actions" in the CodeQL repo to find action-related packs and their exact pack names.
7366
7467
Recommended query packs for this repository (starting point)
75-
7668
- github/codeql/cpp-security-and-quality
7769
- Purpose: Core security and quality queries for C and C++ codebases. Good coverage of common memory safety, API misuse, and typical C/C++ pitfalls.
7870
- Why: Phlex is primarily C++, so this pack is the most important starting point.
@@ -81,7 +73,6 @@ Recommended query packs for this repository (starting point)
8173
- Why: Phlex contains some Python; include this pack so those files are analyzed.
8274
8375
Other useful pack categories to consider
84-
8576
- Language experimental packs (e.g., "cpp-experimental" / "python-experimental")
8677
- These provide newer/experimental queries that are not yet in the stable security-and-quality pack. Use cautiously: they can produce more findings and more false positives.
8778
- Action/workflow packs (GitHub Actions specific)
@@ -90,17 +81,15 @@ Other useful pack categories to consider
9081
- If Phlex heavily uses a certain third-party library that has its own pack, consider enabling it to get library-specific rules.
9182
9283
How to find the exact pack names and descriptions
93-
9484
- Official source: the GitHub CodeQL packs and QL repos:
95-
- <https://github.com/github/codeql/tree/main/packs>
96-
- <https://github.com/github/codeql/tree/main/ql>
85+
- https://github.com/github/codeql/tree/main/packs
86+
- https://github.com/github/codeql/tree/main/ql
9787
- CodeQL CLI (partial support for pack discovery):
9888
- You can use `codeql pack` and `codeql resolve` commands to inspect installed packs. The CodeQL CLI documentation shows usage for installing and listing packs.
9989
- GitHub docs:
10090
- Code scanning docs and the CodeQL repo README often list recommended packs and query categories.
10191

10292
Suggested immediate next steps
103-
10493
1. Keep the current packs (cpp-security-and-quality and python-security-and-quality) enabled in `.github/codeql/codeql-config.yml` — they are the right baseline.
10594
2. Search the CodeQL packs index for any GitHub Actions pack and enable it if you want workflow-level checks.
10695
3. If you want more thorough coverage, enable the experimental packs temporarily in a non-blocking run, review the alerts, then decide whether to include them in CI permanently.
@@ -136,3 +125,4 @@ When a PR is opened from a fork, the `GITHUB_TOKEN` does not have permission to
136125
## Contact / Ownership
137126

138127
- Consider adding a CODEOWNERS file for the phlex-src tree so triage notifications reach the most appropriate maintainers.
128+
```

.github/REUSABLE_WORKFLOWS.md

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,13 @@ Once you have done this, you can trigger the auto-fix workflows by commenting on
2828
For workflows that automatically commit fixes to pull requests (e.g., formatters), you must create a Personal Access Token (PAT) and add it as a secret to your repository.
2929

3030
1. **Create a PAT:** Follow the GitHub documentation to [create a fine-grained personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-fine-grained-personal-access-token).
31-
- Give it a descriptive name (e.g., `WORKFLOW_FIXES_PAT`).
32-
- Grant it the following repository permissions:
33-
- `Contents`: `Read and write`
34-
- `Pull requests`: `Read and write`
31+
- Give it a descriptive name (e.g., `WORKFLOW_FIXES_PAT`).
32+
- Grant it the following repository permissions:
33+
- `Contents`: `Read and write`
34+
- `Pull requests`: `Read and write`
3535
2. **Add the PAT as a Repository Secret:**
36-
- In your repository, go to `Settings` > `Secrets and variables` > `Actions`.
37-
- Create a new repository secret named `WORKFLOW_PAT` and paste your PAT as the value.
36+
- In your repository, go to `Settings` > `Secrets and variables` > `Actions`.
37+
- Create a new repository secret named `WORKFLOW_PAT` and paste your PAT as the value.
3838

3939
### Calling a Reusable Workflow from a Different Repository
4040

@@ -80,14 +80,14 @@ jobs:
8080

8181
#### All Inputs
8282

83-
- `checkout-path` (string, optional): Path to check out code to.
84-
- `build-path` (string, optional): Path for build artifacts.
85-
- `skip-relevance-check` (boolean, optional, default: `false`): Bypass the check that only runs the build if C++ or CMake files have changed.
86-
- `build-combinations` (string, optional): A space-separated list of build combinations to run.
87-
- `ref` (string, optional): The branch or ref to check out.
88-
- `repo` (string, optional): The repository to check out from (e.g., `my-org/my-repo`).
89-
- `pr-base-sha` (string, optional): Base SHA of the PR for relevance check.
90-
- `pr-head-sha` (string, optional): Head SHA of the PR for relevance check.
83+
- `checkout-path` (string, optional): Path to check out code to.
84+
- `build-path` (string, optional): Path for build artifacts.
85+
- `skip-relevance-check` (boolean, optional, default: `false`): Bypass the check that only runs the build if C++ or CMake files have changed.
86+
- `build-combinations` (string, optional): A space-separated list of build combinations to run.
87+
- `ref` (string, optional): The branch or ref to check out.
88+
- `repo` (string, optional): The repository to check out from (e.g., `my-org/my-repo`).
89+
- `pr-base-sha` (string, optional): Base SHA of the PR for relevance check.
90+
- `pr-head-sha` (string, optional): Head SHA of the PR for relevance check.
9191

9292
### 2. `python-check.yaml`
9393

@@ -103,10 +103,10 @@ jobs:
103103

104104
#### All Inputs
105105

106-
- `checkout-path` (string, optional): Path to check out code to.
107-
- `skip-relevance-check` (boolean, optional, default: `false`): Bypass the check that only runs if Python files have changed.
108-
- `pr-base-sha` (string, optional): Base SHA of the PR for relevance check.
109-
- `pr-head-sha` (string, optional): Head SHA of the PR for relevance check.
106+
- `checkout-path` (string, optional): Path to check out code to.
107+
- `skip-relevance-check` (boolean, optional, default: `false`): Bypass the check that only runs if Python files have changed.
108+
- `pr-base-sha` (string, optional): Base SHA of the PR for relevance check.
109+
- `pr-head-sha` (string, optional): Head SHA of the PR for relevance check.
110110

111111
### 3. `cmake-format-fix.yaml`
112112

@@ -140,9 +140,9 @@ jobs:
140140

141141
#### All Inputs
142142

143-
- `checkout-path` (string, optional): Path to check out code to.
144-
- `ref` (string, **required**): The branch or ref to check out.
145-
- `repo` (string, **required**): The repository to check out from.
143+
- `checkout-path` (string, optional): Path to check out code to.
144+
- `ref` (string, **required**): The branch or ref to check out.
145+
- `repo` (string, **required**): The repository to check out from.
146146

147147
### 4. `python-fix.yaml`
148148

@@ -154,23 +154,23 @@ Automatically formats and fixes Python code using `ruff` and commits the changes
154154

155155
#### All Inputs
156156

157-
- `checkout-path` (string, optional): Path to check out code to.
158-
- `ref` (string, **required**): The branch or ref to check out.
159-
- `repo` (string, **required**): The repository to check out from.
157+
- `checkout-path` (string, optional): Path to check out code to.
158+
- `ref` (string, **required**): The branch or ref to check out.
159+
- `repo` (string, **required**): The repository to check out from.
160160

161161
### 5. `markdown-fix.yaml`
162162

163163
Automatically formats Markdown files using `markdownlint` and commits the changes. Typically triggered by an `issue_comment`.
164164

165-
#### Usage Example: `markdown-fix.yaml` (in a workflow triggered by `issue_comment`)
165+
#### Usage Example (in a workflow triggered by `issue_comment`)
166166

167167
*Similar to `cmake-format-fix.yaml`, but triggered by a command like `@<repo>bot markdown-fix`.*
168168

169-
#### All Inputs: `markdown-fix.yaml`
169+
#### All Inputs
170170

171-
- `checkout-path` (string, optional): Path to check out code to.
172-
- `ref` (string, **required**): The branch or ref to check out.
173-
- `repo` (string, **required**): The repository to check out from.
171+
- `checkout-path` (string, optional): Path to check out code to.
172+
- `ref` (string, **required**): The branch or ref to check out.
173+
- `repo` (string, **required**): The repository to check out from.
174174

175175
### Other Workflows
176176

.github/copilot-instructions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ If the workspace root contains a `srcs/` directory, it may contain symbolic link
9494

9595
## Text Formatting Standards
9696

97-
### CRITICAL: Apply to ALL files you create or edit (bash scripts, Python, C++, YAML, Markdown, etc.)
97+
**CRITICAL: Apply to ALL files you create or edit (bash scripts, Python, C++, YAML, Markdown, etc.)**
9898

9999
- All text files must have their final line be non-empty and terminated with a single newline character, leaving no trailing blank lines
100100
- **Never add trailing whitespace on any line** (spaces or tabs at end of lines)

.markdownlint.jsonc

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
{
2-
"default": true,
3-
"MD012": true,
4-
"MD013": false,
5-
"MD022": true,
6-
"MD031": true,
7-
"MD032": true,
8-
"MD034": true,
9-
"MD036": {
10-
"punctuation": ".,;:!?"
11-
},
12-
"MD040": true
2+
"config": {
3+
"default": true,
4+
"MD012": true,
5+
"MD013": false,
6+
"MD022": true,
7+
"MD031": true,
8+
"MD032": true,
9+
"MD034": true,
10+
"MD036": {
11+
"punctuation": ".,;:!?"
12+
},
13+
"MD040": true
14+
}
1315
}

DEVELOPING.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ The project automatically runs coverage analysis on every PR and push to main/de
114114

115115
Coverage reports are uploaded to Codecov for tracking and PR integration, with automatic comments on PRs showing coverage changes.
116116

117+
117118
## On GitHub Copilot
118119

119120
The `.github/copilot-instructions.md` contains various "ground rules" to be observed by GitHub Copilot for every session. They are intended to be useful for everyone, but you can override or augment them yourself by creating a `<workspace>/.github/copilot-instructions.md` file. If this file exists, its contents will be merged with—but take precedence over—the repository level instructions.

INSTALLATION.md

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Overview
1+
## Overview
22

33
These instructions are intended to get users (not developers) of Phlex to a working environment, starting from scratch.
44
This is not the only way in which this can be done, but this method has been verified on the primary supported OS (Alma Linux 9) and will be supported by the Phlex development team on that platform.
@@ -7,7 +7,7 @@ We assume that you do *not* have an installation of Spack already.
77
We only support Spack v1.0 and newer, so if you have an older version of Spack we recommend installation of a new one according to these instructions.
88
If you already have a new-enough version of Spack installed, you can skip to step 6.
99

10-
## Installing Spack
10+
### Installing Spack
1111

1212
Step 1: create a working directory for phlex use:
1313

@@ -22,27 +22,22 @@ cd ${PHLEX_WORK_DIR}
2222
```
2323

2424
Then make sure you don't already have a spack command on your PATH:
25-
2625
```bash
2726
which spack
2827
```
29-
3028
should tell you there is no spack in your PATH.
3129

3230
Step 2: install Spack
3331

3432
```bash
3533
git clone --depth=2 https://github.com/spack/spack.git
3634
```
37-
3835
If you encounter trouble, consult the [installation instructions from the Spack project]( https://spack-tutorial.readthedocs.io/en/latest/tutorial_basics.html#basics-tutorial).
3936

4037
Step 3: make spack available at the command line.
41-
4238
```bash
4339
source ${PHLEX_WORK_DIR}/spack/share/spack/setup-env.sh
4440
```
45-
4641
`which spack` will show that `spack` is a bash function.
4742

4843
Step 4: run the `spack bootstrap now` command to make sure that `${HOME}/.spack` exists and is populated properly.
@@ -53,11 +48,9 @@ Step 5: Modify the Spack configuration to avoid filling `/tmp`.
5348
This is not at all related to Phlex, but until there is spack documentation describing this, we recommend it as good practice.
5449

5550
Run the following, which will open an editor.
56-
5751
```bash
5852
spack config edit config
5953
```
60-
6154
Modify the file to include a new key, `build_stage`.
6255
`config` key may already be in the file and may already contain other keys.
6356
Pay careful attention to the indentation and spacing; YAML is sensitive to these.
@@ -68,7 +61,7 @@ config:
6861
- $spack/var/spack/stage
6962
```
7063
71-
## Ensuring a sufficient compiler
64+
### Ensuring a sufficient compiler
7265
7366
Step 6: ensure that spack has access to a new enough GCC.
7467
Currently this means GCC 14.
@@ -85,7 +78,7 @@ spack install -j 12 gcc@14 # choose a suitable number of jobs for your machine
8578

8679
Building GCC may take a while (30 minutes or so on a 12 core machine).
8780

88-
## Creating and installing the Phlex environment
81+
### Creating and installing the Phlex environment
8982

9083
Step 7: Add the Spack recipe repositories needed by Phlex:
9184

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ Once you have Phlex installed, you can start creating algorithms and using them
1515
[A repository with example user code](https://github.com/framework-r-d/phlex-examples) is available to help you get started.
1616
Clone that repository and follow the instructions there to begin using Phlex.
1717

18+
1819
## Developing Phlex
1920

2021
Instructions for the development of Phlex itself are in the [developer notes](DEVELOPING.md)

form/README.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ Prototype development for I/O infrastructure supporting Phlex
1010

1111
`./test/form/phlex_writer ; ls -l toy.root`
1212

13-
## ROOT checks
14-
15-
```cpp
13+
## ROOT checks:
14+
```
1615
TFile* file = TFile::Open("toy.root")
1716
file->ls()
1817
TTree* tree1 = (TTree*)file->Get("<ToyAlg_Segment>");
@@ -23,6 +22,6 @@ tree1->Scan()
2322
tree2->Scan()
2423
```
2524

26-
## run reader
25+
# run reader
2726

2827
`./test/form/phlex_reader`

scripts/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ The script automatically detects and adapts to:
5353
Configure the script behavior by setting these variables **before** sourcing:
5454

5555
| Variable | Description | Example |
56-
| :--- | :--- | :--- |
56+
|----------|-------------|---------|
5757
| `PHLEX_SPACK_ROOT` | Path to Spack installation | `export PHLEX_SPACK_ROOT=/opt/spack` |
5858
| `PHLEX_SPACK_ENV` | Spack environment to activate | `export PHLEX_SPACK_ENV=phlex-dev` |
5959
| `PHLEX_BUILD_DIR` | Build directory location | `export PHLEX_BUILD_DIR=/tmp/phlex-build` |
@@ -165,7 +165,7 @@ Provides convenient commands for managing code coverage analysis.
165165
#### Commands
166166

167167
| Command | Description |
168-
| :--- | :--- |
168+
|---------|-------------|
169169
| `setup` | Configure and build with coverage instrumentation |
170170
| `clean` | Remove coverage data files (C++ and Python) |
171171
| `test` | Run tests with coverage collection (C++ and Python) |

0 commit comments

Comments
 (0)