Skip to content

Commit 330c160

Browse files
edvilmegithub-actions
authored andcommitted
Clean up code
1 parent 9700b6e commit 330c160

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

.github/workflows/remove-lockdown-label.yml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,12 @@ jobs:
1616
- name: Checkout repository
1717
uses: actions/checkout@v2
1818

19-
# flagged user-visible change: replaced shell script with JS to check <VersionFeature>user-visible change: replaced shell script with JS to check <VersionFeature>
20-
- name: PR's only change is <VersionFeature> in eng/Versions.propsly change is <VersionFeature> in eng/Versions.props
19+
- name: PR's only change is <VersionFeature> in eng/Versions.props
2120
uses: actions/github-script@v4
2221
with:
2322
script: |
23+
const otherChangesMessage = "❌ Changes in eng/Versions.props other than <VersionFeature> found";
24+
const onlyVersionFeatureMessage = "✅ PR's only change is <VersionFeature> in eng/Versions.props";
2425
const prNumber = context.payload.pull_request.number;
2526
const { data: files } = await github.pulls.listFiles({
2627
owner: context.repo.owner,
@@ -29,7 +30,7 @@ jobs:
2930
});
3031
// If files other than eng/Versions.props are changed, output message and exit
3132
if (files.some(file => file.filename !== "eng/Versions.props")) {
32-
console.log("❌ Changes in eng/Versions.props other than <VersionFeature> found");
33+
console.log(otherChangesMessage);
3334
core.exportVariable("only_version_feature_changed", "false");
3435
return;
3536
}
@@ -38,16 +39,16 @@ jobs:
3839
const patchLines = versionsPropsFile.patch.split("\n").filter(l => l.startsWith("+") || l.startsWith("-"));
3940
for (const line of patchLines) {
4041
if (!line.includes("<VersionFeature>")) {
41-
console.log("❌ Changes in eng/Versions.props other than <VersionFeature> found");
42+
console.log(otherChangesMessage);
4243
core.exportVariable("only_version_feature_changed", "false");
4344
return;
4445
}
4546
}
46-
console.log("✅ PR's only change is <VersionFeature> in eng/Versions.props");
47+
console.log(onlyVersionFeatureMessage);
4748
core.exportVariable("only_version_feature_changed", "true");
4849
4950
- name: Remove Branch Lockdown label from other PRs targeting this branch
50-
if: steps.PR_has_Branding_label.outputs.has_branding_label == 'true' && steps.PR_only_change_is_VersionFeature_in_eng_Versions_props.outputs.only_version_feature_changed == 'true'
51+
if: steps.PR_only_change_is_VersionFeature_in_eng_Versions_props.outputs.only_version_feature_changed == 'true'
5152
uses: actions/github-script@v4
5253
with:
5354
script: |

0 commit comments

Comments
 (0)