Skip to content

[SDK Breaking Change Labels] May add artifact label-=(true|false)Β #36536

@mikeharder

Description

@mikeharder

WF "SDK Breaking Change Labels" may add an invalid artifact named label-=false or label-=true.

Examples:

false: https://github.com/Azure/azure-rest-api-specs/actions/runs/16817684261

I believe the root cause is spread across two files:

export const sdkLabels = {
"azure-sdk-for-go": {
breakingChange: "BreakingChange-Go-Sdk",
breakingChangeApproved: "BreakingChange-Go-Sdk-Approved",
breakingChangeSuppression: "BreakingChange-Go-Sdk-Suppression",
breakingChangeSuppressionApproved: "BreakingChange-Go-Sdk-Suppression-Approved",
},
"azure-sdk-for-java": {
breakingChange: undefined,
breakingChangeApproved: undefined,
breakingChangeSuppression: undefined,
breakingChangeSuppressionApproved: undefined,
},

const breakingChangeLanguage = specGenSdkArtifactInfo.language;
if (breakingChangeLanguage) {
labelName = sdkLabels[`${breakingChangeLanguage}`].breakingChange;
}
// Set label action and name based on the artifacts
if (labelActionText === true) {
labelAction = LabelAction.Add;
} else if (labelActionText === false) {
labelAction = LabelAction.Remove;
}
}
if (!labelAction) {
core.info("No label action found, defaulting to None");
labelAction = LabelAction.None;
}
return { labelName, labelAction, headSha: head_sha, issueNumber: issue_number };

For Java and Net, the labels are undefined, which causes us to return objects like:

{ labelName: "", labelAction: LabelAction.Add, ... }

Which causes use to add an empty label artifact:

- if: |
(fromJson(steps.get-label-and-action.outputs.result).labelAction == 'add' ||
fromJson(steps.get-label-and-action.outputs.result).labelAction == 'remove')
name: Upload artifact with results
uses: ./.github/actions/add-label-artifact
with:
name: "${{ fromJson(steps.get-label-and-action.outputs.result).labelName}}"
# Convert "add/remove" to "true/false"
value: "${{ fromJson(steps.get-label-and-action.outputs.result).labelAction == 'add' }}"

Fortunately, when update-labels processes this artifact, it's a no-op. Trying to add or remove a label named "" should always fail and effectively be a no-op.

But, this still should be fixed in sdk-breaking-change-labels. I think the fix could be as simple as this:

Image

We would now return:

{ labelName: "", labelAction: LabelAction.None, ... }

Which is a cleaner no-op, avoids adding the label artifact and triggering update-labels.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

🎊 Closed

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions