ci(metadata): Add merge method labels and description-based auto-labeling - #2433
ci(metadata): Add merge method labels and description-based auto-labeling#2433tintinhamans wants to merge 1 commit into
Conversation
|
| Filename | Overview |
|---|---|
| .github/workflows/validate-pull-request.yml | Significant rework adding description-based auto-labeling, per-label merge method detection (Squash/Rebase), and a central result-aggregation step; overall logic is sound but contains a dead LABELS_OUTCOME env var in the post-comment step and has several edge-case interactions documented across previous review threads. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[PR Event\nopened/edited/synchronize/reopened/labeled/unlabeled] --> B[apply-merge-labels]
B -->|labeled/unlabeled event| C[Skip – manual label event]
B -->|synchronize + label already present| D[Skip – respect manual override]
B -->|Description matches squash/rebase pattern| E[gh pr edit: add/swap label]
B -->|No matching pattern| F[No label change]
C & D & E & F --> G[Detect merge method labels\nvia GitHub API]
G -->|API failure| H[squash=false, rebase=false, conflict=false\nexit 1 → INFRA_FAILED]
G -->|Both Squash + Rebase| I[conflict=true\nexit 1 → validation failure]
G -->|Squash only| J[squash=true]
G -->|Rebase or no label| K[squash=false]
J & K --> L[Checkout base branch]
I & H --> L
L --> M[Fetch PR head\nSkipped if squash=true or conflict]
L --> N[Load valid tags]
N --> O[Validate PR title\nAlways runs when tags loaded]
M --> P[Validate PR commits\nSkipped if squash=true, conflict, or labels failed]
O & P --> Q[Determine validation result\naggregates infra + validation failures]
Q -->|failed=true| R[Post failure comment]
Q -->|failed=false| S[Skip comment]
R --> T[Delete stale bot comments\nusing OLD_COMMENT_IDS captured before posting]
S --> T
T --> U{failed?}
U -->|true| V[exit 1 – job fails]
U -->|false| W[Job passes]
Prompt To Fix All With AI
This is a comment left during a code review.
Path: .github/workflows/validate-pull-request.yml
Line: 405
Comment:
**Unused `LABELS_OUTCOME` env var**
`LABELS_OUTCOME` is declared in the step's `env:` block but is never referenced anywhere inside the `run:` script (lines 408–463). The post-comment body is constructed using `IS_CONFLICT`, `IS_SQUASH`, `IS_REBASE`, `INFRA_FAILED`, and `AUTOLABEL_WARNING` — `LABELS_OUTCOME` contributes nothing. Removing it avoids confusion for future maintainers who might assume it drives some conditional logic.
```suggestion
AUTOLABEL_WARNING: ${{ steps.apply-merge-labels.outputs.autolabel-warning }}
VALID_TAGS: ${{ steps.load-tags.outputs.valid-tags }}
IS_SQUASH: ${{ steps.labels.outputs.squash }}
IS_REBASE: ${{ steps.labels.outputs.rebase }}
IS_CONFLICT: ${{ steps.labels.outputs.conflict }}
INFRA_FAILED: ${{ steps.result.outputs.infra_failed }}
RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
```
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: f12a758
|
Can you also add a way to disable conventional commit tags check for the commits? For example by placing a keyword into the Pull description. Then only check it on the Pull Request title. |
Maybe check to see if the PR description contains "merge by rebase" |
3c87c60 to
6dad9e8
Compare
6dad9e8 to
8dc6692
Compare
8dc6692 to
6205cfb
Compare
6205cfb to
9cf3b1c
Compare
9cf3b1c to
d939c61
Compare
xezon
left a comment
There was a problem hiding this comment.
The described functionality looks good to me. Does it work?
I have merged this to main on my fork https://github.com/tintinhamans/GeneralsGameCode, feel free to submit a test PR there to test. |
|
Can you test it? I trust you if you say it works. |
f8612a6 to
d3d8303
Compare
d3d8303 to
b0112a1
Compare
3cb6871 to
794b141
Compare
05ad495 to
7203ddc
Compare
|
Had to unsubscribe to this, it was blowing up my phone too much, munkee needs his sleep! lol |
7203ddc to
3c8d974
Compare
56c82dd to
49a7058
Compare
49a7058 to
c44c9f5
Compare
This pull request updates the
validate-pull-request.ymlworkflow to recognise labels "Squash" and "Rebase". It also detects and applies labels from the PR description.labeledandunlabeledevents workflow triggers.