Skip to content

test: add a workflow that tests the action on a real PR - #72

Merged
shenxianpeng merged 2 commits into
masterfrom
claude/project-thread-eikc8z
Nov 10, 2026
Merged

shenxianpeng merged 2 commits into
masterfrom
claude/project-thread-eikc8z

Conversation

@shenxianpeng

@shenxianpeng shenxianpeng commented Nov 10, 2026 •

Copy link
Copy Markdown
Member

Until now, testing a cpp-linter-action branch or release candidate on a real pull request was done by hand: make a branch with bad code, open a temporary PR, read the comments, close it. This workflow does those steps.

How it works

e2e on a real PR (.github/workflows/e2e-pr.yml):

  1. Run workflow with an action ref (for example main or v3.0.0-rc0) and a clang version. The open-pr job creates a branch e2e/run-<id>, copies .github/e2e/demo.cpp.txt over src/demo.cpp (known clang-tidy and clang-format problems), writes the target to .github/e2e/target.env, and opens a PR.
  2. On that PR, the lint job checks out the action at the chosen ref and runs it on Linux, macOS and Windows with lines-changed-only: true. Only the Linux job posts to the PR (thread comment, review, annotations), so the jobs do not overwrite each other.
  3. The verify job reads the PR through the API and checks: the outputs of each OS, exactly one thread comment, a review that requests changes, review comments, and file annotations on src/. It posts the table as a PR comment.
  4. If everything passed, it closes the PR and deletes the branch. If not, the PR stays open and the job fails.

The existing workflows are not changed. The fixture is named .txt so that their full scans do not pick it up.

One limitation

GitHub does not start workflows for a PR that was opened with the default GITHUB_TOKEN. So after step 1, either:

  • close and reopen the PR by hand (the workflow prints this as a warning), or
  • add a repository secret E2E_TOKEN (a fine-grained token with "Contents" and "Pull requests" write access to this repo). The workflow uses it when it exists, and then everything runs from the one click.

Tested

Trial run in #71, a temporary PR made the same way the open-pr job makes one, against cpp-linter-action@main: all checks passed on the 3 systems (6 findings each: 5 clang-tidy, 1 clang-format; 1 thread comment, 1 review with 4 comments, 6 annotations), and the PR was closed and its branch deleted by the workflow. The open-pr job itself can only run once the workflow is on master.

actionlint passes. The actions are pinned to the same commit as in the other org repos.

"Run workflow" opens a PR with known lint problems, runs the chosen
cpp-linter-action ref on it on 3 operating systems, checks the thread
comment, review, annotations and outputs, and reports the result.
@shenxianpeng shenxianpeng self-assigned this Nov 10, 2026
@shenxianpeng
shenxianpeng merged commit a6df0af into master Nov 10, 2026
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