Skip to content

Commit 83dd285

Browse files
Merged PR 50922: merge from public
2 parents 488d157 + dee5fc1 commit 83dd285

File tree

175 files changed

+801
-6962
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+801
-6962
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
name: Remove Lockdown Label from PRs
2+
3+
on:
4+
pull_request:
5+
types: [closed]
6+
7+
permissions:
8+
actions: write
9+
pull-requests: write
10+
11+
jobs:
12+
remove-labels:
13+
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'Branding')
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v2
18+
19+
- name: PR's only change is <VersionFeature> in eng/Versions.props
20+
id: only_version_feature_changed
21+
uses: actions/github-script@v4
22+
with:
23+
script: |
24+
const otherChangesMessage = "❌ Changes in eng/Versions.props other than <VersionFeature> found";
25+
const onlyVersionFeatureMessage = "✅ PR's only change is <VersionFeature> in eng/Versions.props";
26+
const prNumber = context.payload.pull_request.number;
27+
const { data: files } = await github.pulls.listFiles({
28+
owner: context.repo.owner,
29+
repo: context.repo.repo,
30+
pull_number: prNumber
31+
});
32+
// If files other than eng/Versions.props are changed, output message and exit
33+
if (files.some(file => file.filename !== "eng/Versions.props")) {
34+
console.log(otherChangesMessage);
35+
core.exportVariable("only_version_feature_changed", "false");
36+
return;
37+
}
38+
// Iterate through the patch of eng/Versions.props to check for changes other than <VersionFeature>
39+
const versionsPropsFile = files.find(file => file.filename === "eng/Versions.props");
40+
const patchLines = versionsPropsFile.patch.split("\n").filter(l => l.startsWith("+") || l.startsWith("-"));
41+
for (const line of patchLines) {
42+
if (!line.includes("<VersionFeature>")) {
43+
console.log(otherChangesMessage);
44+
core.exportVariable("only_version_feature_changed", "false");
45+
return;
46+
}
47+
}
48+
console.log(onlyVersionFeatureMessage);
49+
core.exportVariable("only_version_feature_changed", "true");
50+
51+
- name: Remove Branch Lockdown label from other PRs targeting this branch
52+
if: steps.only_version_feature_changed.outputs.only_version_feature_changed == 'true'
53+
uses: actions/github-script@v4
54+
with:
55+
script: |
56+
const prs = await github.pulls.list({
57+
owner: context.repo.owner,
58+
repo: context.repo.repo,
59+
state: 'open',
60+
base: github.event.pull_request.base.ref,
61+
per_page: 300
62+
});
63+
const filtered_prs = prs.data
64+
.filter(pr => pr.number !== github.context.payload.pull_request.number)
65+
.filter(pr => pr.labels.map(label => label.name).includes('Branch Lockdown'));
66+
for (const pr of filtered_prs) {
67+
await github.issues.removeLabel({
68+
owner: context.repo.owner,
69+
repo: context.repo.repo,
70+
issue_number: pr.number,
71+
name: 'Branch Lockdown'
72+
});
73+
console.log(`Removed Branch Lockdown label from PR #${pr.number}`);
74+
}

NuGet.config

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
<add key="darc-int-dotnet-aspnetcore-3720a89" value="https://pkgs.dev.azure.com/dnceng/internal/_packaging/darc-int-dotnet-aspnetcore-3720a893/nuget/v3/index.json" />
3131
<!-- End: Package sources from dotnet-aspnetcore -->
3232
<!-- Begin: Package sources from DotNet-msbuild-Trusted -->
33+
<add key="darc-pub-DotNet-msbuild-Trusted-590305f" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-DotNet-msbuild-Trusted-590305fc/nuget/v3/index.json" />
3334
<!-- End: Package sources from DotNet-msbuild-Trusted -->
3435
<!-- Begin: Package sources from dotnet-roslyn-analyzers -->
3536
<!-- End: Package sources from dotnet-roslyn-analyzers -->
@@ -40,6 +41,7 @@
4041
<add key="darc-pub-dotnet-templating-0c96b36" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-templating-0c96b36c/nuget/v3/index.json" />
4142
<add key="darc-pub-dotnet-templating-0c96b36-2" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-templating-0c96b36c-2/nuget/v3/index.json" />
4243
<add key="darc-pub-dotnet-templating-0c96b36-1" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-templating-0c96b36c-1/nuget/v3/index.json" />
44+
<add key="darc-pub-dotnet-templating-088027f" value="https://pkgs.dev.azure.com/dnceng/public/_packaging/darc-pub-dotnet-templating-088027fb/nuget/v3/index.json" />
4345
<!-- End: Package sources from dotnet-templating -->
4446
<!-- Begin: Package sources from dotnet-windowsdesktop -->
4547
<add key="darc-int-dotnet-windowsdesktop-4c31f57" value="https://pkgs.dev.azure.com/dnceng/internal/_packaging/darc-int-dotnet-windowsdesktop-4c31f574/nuget/v3/index.json" />

0 commit comments

Comments
 (0)