Skip to content

[release/9.x] Merge feature/9.x #6185

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 138 commits into from
Mar 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
138 commits
Select commit Hold shift + click to select a range
d619a10
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Jan 31, 2024
c6be93c
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 1, 2024
cf07da6
Update dependencies from https://github.com/dotnet/arcade build 20240…
dotnet-maestro[bot] Feb 1, 2024
fc12528
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] Feb 1, 2024
ad6fe0d
Update dependencies from https://github.com/dotnet/arcade build 20240…
dotnet-maestro[bot] Feb 1, 2024
dcfb7df
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 1, 2024
d885e94
Fixup dependencies (#5949)
wiktork Feb 1, 2024
536bded
Fixup dependencies (#5949) (#5950)
github-actions[bot] Feb 1, 2024
31385e3
Update dependencies from https://github.com/dotnet/command-line-api b…
dotnet-maestro[bot] Feb 2, 2024
c1dc0e6
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 2, 2024
d5460f7
Update dependencies from https://github.com/dotnet/command-line-api b…
dotnet-maestro[bot] Feb 2, 2024
9a0700c
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] Feb 2, 2024
c0ea0a2
Update dependencies from https://github.com/dotnet/arcade build 20240…
dotnet-maestro[bot] Feb 2, 2024
4589e81
Learning Paths Automation (#5940)
kkeirstead Feb 2, 2024
abdf19b
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 3, 2024
def0772
Update dependencies from https://github.com/dotnet/command-line-api b…
dotnet-maestro[bot] Feb 3, 2024
2e3dbb0
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] Feb 3, 2024
60ea175
[feature/9.x] Update dependencies from dotnet/arcade (#5970)
dotnet-maestro[bot] Feb 5, 2024
a381e0c
[feature/9.x] Update dependencies from dotnet/command-line-api (#5969)
dotnet-maestro[bot] Feb 5, 2024
f932b6d
[feature/9.x] Update dependencies from dotnet/diagnostics (#5968)
dotnet-maestro[bot] Feb 6, 2024
162bbcf
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 6, 2024
e197e8f
Update dependencies from https://github.com/dotnet/symstore build 202…
dotnet-maestro[bot] Feb 6, 2024
d5bae12
Bump actions/upload-artifact from 4.3.0 to 4.3.1 (#5988)
dependabot[bot] Feb 6, 2024
9407c5b
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 6, 2024
965fa72
Update dependencies from https://github.com/dotnet/symstore build 202…
dotnet-maestro[bot] Feb 6, 2024
5f0050a
Update dependencies from https://github.com/dotnet/arcade build 20240…
dotnet-maestro[bot] Feb 6, 2024
3a88ed1
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 7, 2024
26235d3
Add 6.3.5 release notes (#5996)
github-actions[bot] Feb 8, 2024
cd7dfcd
Add 7.3.3 release notes (#5997)
github-actions[bot] Feb 9, 2024
bf402b2
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 9, 2024
44fbfc9
[feature/9.x] Update dependencies from dotnet/arcade (#6002)
dotnet-maestro[bot] Feb 9, 2024
7e046d8
Add 8.0.1 release notes (#6004)
github-actions[bot] Feb 9, 2024
722456e
Add 9.0.0-preview.1 release notes (#5998)
github-actions[bot] Feb 9, 2024
78564d7
Bump reviewdog/action-setup from 1.2.0 to 1.2.1 (#6007)
dependabot[bot] Feb 9, 2024
66629de
[feature/9.x] Update dependencies from dotnet/diagnostics (#6001)
dotnet-maestro[bot] Feb 9, 2024
d6ed4b2
[main] Update dependencies from dotnet/installer (#6000)
dotnet-maestro[bot] Feb 9, 2024
ac6b45d
Fix the automation for merged/closed PRs (#6005)
jeffhandley Feb 9, 2024
e7dff53
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 10, 2024
5a3f74f
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 10, 2024
9f2461f
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 10, 2024
afac696
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 13, 2024
dde3ade
Update dependencies from https://github.com/dotnet/symstore build 202…
dotnet-maestro[bot] Feb 13, 2024
bf5252a
Update dependencies from https://github.com/dotnet/command-line-api b…
dotnet-maestro[bot] Feb 13, 2024
9c8f17e
Update dependencies from https://github.com/dotnet/command-line-api b…
dotnet-maestro[bot] Feb 13, 2024
e79105c
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 13, 2024
6438cba
Register new release information (#6023)
github-actions[bot] Feb 13, 2024
19d1424
Update dependencies from https://github.com/dotnet/arcade build 20240…
dotnet-maestro[bot] Feb 14, 2024
136f8cf
[main] Update dependencies from dotnet/installer (#6017)
dotnet-maestro[bot] Feb 14, 2024
7abb378
Update dependencies from https://github.com/dotnet/arcade build 20240…
dotnet-maestro[bot] Feb 14, 2024
7d4dfaf
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] Feb 15, 2024
e42eca9
[feature/9.x] Update dependencies from dotnet/arcade (#6026)
dotnet-maestro[bot] Feb 15, 2024
241a62b
Bump dawidd6/action-download-artifact from 3.0.0 to 3.1.0 (#6031)
dependabot[bot] Feb 15, 2024
7fdbe59
Update sync-branches.yml (#6035)
wiktork Feb 15, 2024
05faa18
Add `Updated dependencies` to release changelog when no other entries…
schmittjoseph Feb 15, 2024
6cf373c
Update dependencies from https://github.com/dotnet/arcade build 20240…
dotnet-maestro[bot] Feb 16, 2024
a11b9d5
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 17, 2024
625b07b
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 20, 2024
c1b708d
Bump dawidd6/action-download-artifact from 3.1.0 to 3.1.1 (#6048)
dependabot[bot] Feb 20, 2024
da10612
Fix dependabot's handling of nuget dependencies (#6039)
schmittjoseph Feb 20, 2024
dfd13a2
Let dependabot manage `AWSSDK.S3` (#6059)
schmittjoseph Feb 20, 2024
a0ed682
[feature/9.x] Update dependencies from dotnet/installer (#6033)
dotnet-maestro[bot] Feb 20, 2024
537b898
[main] Bump Microsoft.OpenApi.Readers in /eng/dependabot/independent …
dependabot[bot] Feb 20, 2024
ce82514
[main] Bump Microsoft.NETCore.DotNetHost in /eng/dependabot/net7.0 (#…
dependabot[bot] Feb 20, 2024
4c2be53
[main] Bump Microsoft.Diagnostics.DbgShim in /eng/dependabot/nuget.or…
dependabot[bot] Feb 20, 2024
543ef3d
[main] Bump Microsoft.NETCore.DotNetHost in /eng/dependabot/net6.0 (#…
dependabot[bot] Feb 20, 2024
3cf7ce7
[main] Bump Microsoft.NETCore.DotNetHost in /eng/dependabot/net8.0 (#…
dependabot[bot] Feb 20, 2024
d6ae760
Update dependencies from https://github.com/dotnet/symstore build 202…
dotnet-maestro[bot] Feb 20, 2024
80d6336
[feature/9.x] Update dependencies from dotnet/diagnostics (#6042)
dotnet-maestro[bot] Feb 20, 2024
b987891
Ignore Moq updates via dependabot (#6061)
schmittjoseph Feb 20, 2024
f33f3c0
[feature/9.x] Update dependencies from dotnet/symstore (#6021)
dotnet-maestro[bot] Feb 20, 2024
9b5b2a4
[feature/9.x] Update dependencies from dotnet/roslyn-analyzers (#6034)
dotnet-maestro[bot] Feb 20, 2024
cbc0f41
[main] Bump NJsonSchema from 10.9.0 to 11.0.0 in /eng/dependabot/inde…
dependabot[bot] Feb 20, 2024
828334d
[main] Bump the identity-dependencies group (#6055)
dependabot[bot] Feb 21, 2024
70c3998
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 21, 2024
59b0ff3
Bump dawidd6/action-download-artifact from 3.1.1 to 3.1.2 (#6070)
dependabot[bot] Feb 21, 2024
cca1dad
[main] Bump AWSSDK.S3 from 3.5.8.1 to 3.7.305.7 in /eng/dependabot/in…
dependabot[bot] Feb 21, 2024
50528ed
Simplify dependabot imports (#6071)
schmittjoseph Feb 21, 2024
7ebcc12
Fix github-actions commit author (#6072)
schmittjoseph Feb 21, 2024
ef4e70e
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 22, 2024
8193fe9
Limit learning path automation to main repo (#6078)
schmittjoseph Feb 22, 2024
a159cf8
Bump streetsidesoftware/cspell-action from 5.3.0 to 5.4.0 (#6077)
dependabot[bot] Feb 22, 2024
c1052c6
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 22, 2024
58bcf9c
[feature/9.x] Update dependencies from dotnet/installer (#6069)
dotnet-maestro[bot] Feb 22, 2024
f1f49b6
Update dependencies from https://github.com/dotnet/roslyn-analyzers b…
dotnet-maestro[bot] Feb 22, 2024
e17874e
Include release/8.0 in dependabot updates (#6084)
schmittjoseph Feb 22, 2024
b9ea224
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 23, 2024
044f827
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 23, 2024
9d9266d
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] Feb 23, 2024
8cb9a0d
[main] Update dependencies from dotnet/diagnostics (#6104)
dotnet-maestro[bot] Feb 26, 2024
4e0d81f
[main] Update dependencies from dotnet/command-line-api (#6105)
dotnet-maestro[bot] Feb 26, 2024
5e72223
[feature/9.x] Update dependencies from dotnet/command-line-api (#6109)
dotnet-maestro[bot] Feb 26, 2024
ab8be51
Automatically create merge PRs for `feature/9.x` (#6073)
schmittjoseph Feb 26, 2024
ad1cd01
Update dependencies from https://github.com/dotnet/command-line-api b…
dotnet-maestro[bot] Feb 27, 2024
331a2cd
Update dependencies from https://github.com/dotnet/arcade build 20240…
dotnet-maestro[bot] Feb 27, 2024
2bcfe40
Update dependencies from https://github.com/dotnet/command-line-api b…
dotnet-maestro[bot] Feb 27, 2024
23c5925
Update dependencies from https://github.com/dotnet/arcade build 20240…
dotnet-maestro[bot] Feb 27, 2024
406da5d
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 27, 2024
6a8ec33
[feature/9.x] Update dependencies from dotnet/diagnostics (#6108)
dotnet-maestro[bot] Feb 27, 2024
7faf896
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 28, 2024
4f9931a
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 28, 2024
4ce961e
[main] Bump the identity-dependencies group (#6135)
dependabot[bot] Feb 28, 2024
034a8e1
[feature/9.x] Update dependencies from dotnet/installer (#6111)
dotnet-maestro[bot] Feb 28, 2024
b673b69
Have automated merge commits respect branch-specific files (#6130)
schmittjoseph Feb 28, 2024
4e50245
[feature/9.x] Update dependencies from dotnet/roslyn-analyzers (#6103)
dotnet-maestro[bot] Feb 28, 2024
5f80366
[Parameter Capturing] Add capture limit option (#6060)
schmittjoseph Feb 28, 2024
873e71b
Update .gitattributes (#6136)
schmittjoseph Feb 28, 2024
8eff274
Increase helix test timeouts by 10 minutes (#6137)
schmittjoseph Feb 29, 2024
c631452
Merge remote-tracking branch 'origin/main' into feature/9.x
github-actions[bot] Feb 29, 2024
1ff3650
Restore branch-specific files
github-actions[bot] Feb 29, 2024
b30e457
Backport #6071
schmittjoseph Feb 29, 2024
2c4c7f6
Merge pull request #6140 from dotnet/bot/sync/feature/9.x
schmittjoseph Feb 29, 2024
9621dde
[feature/9.x] Update dependencies from dotnet/arcade (#6133)
dotnet-maestro[bot] Feb 29, 2024
e1b5a0e
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Feb 29, 2024
deb5301
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] Feb 29, 2024
963f582
Ignore deleted files when check markdown feedback links (#6147)
jander-msft Feb 29, 2024
30ccf90
Update dependencies from https://github.com/dotnet/roslyn-analyzers b…
dotnet-maestro[bot] Feb 29, 2024
79b2425
Update dependencies from https://github.com/dotnet/roslyn-analyzers b…
dotnet-maestro[bot] Mar 1, 2024
6a10a7e
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Mar 1, 2024
95778f1
Update Learning Paths (#6148)
github-actions[bot] Mar 1, 2024
5e898da
Skip CollectionRulePipeline_EventMeterTriggerTest_Histogram_GreaterTh…
schmittjoseph Mar 1, 2024
1f2ddc2
Scan all executable files (#6156)
jander-msft Mar 1, 2024
6380db2
Replace SwaggerUI and SwaggerScope option with OpenAPI document (#6146)
jander-msft Mar 1, 2024
0871877
Merge remote-tracking branch 'origin/main' into feature/9.x
github-actions[bot] Mar 1, 2024
2649b1b
Merge pull request #6158 from dotnet/bot/sync/feature/9.x
schmittjoseph Mar 1, 2024
83c1188
Update dependencies from https://github.com/dotnet/installer build 20…
dotnet-maestro[bot] Mar 2, 2024
42151ad
[feature/9.x] Update dependencies from dotnet/diagnostics (#6143)
dotnet-maestro[bot] Mar 2, 2024
413a2d5
Update dependencies from https://github.com/dotnet/arcade build 20240…
dotnet-maestro[bot] Mar 2, 2024
1e9d8be
Update dependencies from https://github.com/dotnet/arcade build 20240…
dotnet-maestro[bot] Mar 2, 2024
7c060fe
Update dependencies from https://github.com/dotnet/diagnostics build …
dotnet-maestro[bot] Mar 2, 2024
900effa
Bump streetsidesoftware/cspell-action from 5.4.0 to 6.0.0 (#6169)
dependabot[bot] Mar 4, 2024
1b90490
[feature/9.x] Update dependencies from dotnet/installer (#6167)
dotnet-maestro[bot] Mar 4, 2024
26aafad
[feature/9.x] Update dependencies from dotnet/arcade (#6165)
dotnet-maestro[bot] Mar 4, 2024
dc02b47
[main] Update dependencies from dotnet/diagnostics (#6161)
dotnet-maestro[bot] Mar 4, 2024
66b7d1a
Sync branch improvements (#6172)
schmittjoseph Mar 4, 2024
7965094
Merge remote-tracking branch 'origin/main' into feature/9.x
github-actions[bot] Mar 4, 2024
404c7ee
Restore branch-specific files
github-actions[bot] Mar 4, 2024
2535c54
Merge pull request #6176 from dotnet/bot/sync/feature/9.x
schmittjoseph Mar 4, 2024
5e23227
Merge remote-tracking branch 'upstream/feature/9.x' into merge-featur…
schmittjoseph Mar 5, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -47,3 +47,13 @@
###############################################################################
*.png binary
*.snk binary

###############################################################################
# Define branch specific files by overriding the merge driver
###############################################################################
global.json merge=ours
eng/branch-vscode-config merge=ours
eng/common merge=ours
eng/Common.props merge=ours
eng/Versions.props merge=ours
eng/Version.Details.xml merge=ours
2 changes: 1 addition & 1 deletion .github/actions/action-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ module.exports.friendlyDateFromISODate = function(isoDate) {

module.exports.splitVersionTag = splitVersionTag;
module.exports.readFile = (fileName) => util.promisify(fs.readFile)(fileName, 'utf8');
module.exports.writeFile = (fileName, contents) => util.promisify(fs.writeFile)(fileName, contents);
module.exports.writeFile = (fileName, contents) => util.promisify(fs.writeFile)(fileName, contents);
4 changes: 4 additions & 0 deletions .github/actions/generate-release-notes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ async function generateChangelog(octokit, branch, repoOwner, repoName, minMergeD
changelog.push(entry);
}

if (changelog.length === 0) {
changelog.push("- Updated dependencies");
}

return changelog.join("\n");
}

Expand Down
30 changes: 30 additions & 0 deletions .github/actions/learning-path-staleness-check/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: 'CheckLearningPathLinks Action'
description: 'Checks the links in the learning paths for staleness'
inputs:
repoURLToSearch:
description: 'The repo referenced in the learning path docs (in URL form)'
required: true
learningPathsDirectory:
description: 'The directory where the learning paths reside (e.g. documentation/learningPath)'
required: true
changedFilePaths:
description: 'Paths to the changed files'
required: false
sourceDirectoryName:
description: 'The name of the top-level directory (e.g. src) - only files inside this directory will be included in the search'
required: true
oldHash:
description: 'The hash currently being used by the learning path'
required: true
newHash:
description: 'The hash to be inserted into the updated learning path'
required: true
learningPathHashFile:
description: 'The file where the commit hash being used for the learning paths is kept'
required: true
excludeLinks:
description: 'Comma separated strings to exclude from processing'
required: false
runs:
using: 'node16'
main: 'index.js'
274 changes: 274 additions & 0 deletions .github/actions/learning-path-staleness-check/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,274 @@
const actionUtils = require('../action-utils.js');
const fs = require('fs');
const path = require('path');
const prevPathPrefix = "prev/";
const linePrefix = "#L";
const separator = " | ";

modifiedFilesPathToLearningPathFile = {};
modifiedFilesUrlToFileName = {};

var outOfSync = new Set();
var manuallyReview = new Set();
var suggestions = new Set();
var modifiedFiles = new Set();

const oldNewLinkSeparator = ' -> ';

function ReplaceOldWithNewText(content, oldText, newText)
{
return content.replaceAll(oldText, newText);
}

function UpdateModifiedFiles(fileName, path, learningPathFile)
{
modifiedFilesUrlToFileName[path] = fileName;

modifiedFilesPathToLearningPathFile[path] = modifiedFilesPathToLearningPathFile[path] ? modifiedFilesPathToLearningPathFile[path] : new Set();;
modifiedFilesPathToLearningPathFile[path].add(learningPathFile);

modifiedFiles = new Set();
for (currPath in modifiedFilesPathToLearningPathFile)
{
const fileName = modifiedFilesUrlToFileName[currPath];
modifiedFiles.add(AssembleModifiedFilesOutput(fileName, currPath, Array.from(modifiedFilesPathToLearningPathFile[currPath])));
}
}

function AssembleModifiedFilesOutput(fileName, path, learningPathFiles)
{
return CreateLink(fileName, path, undefined) + separator + BoldedText(learningPathFiles.join(" "));
}

function BoldedText(text)
{
return "**" + text + "**";
}

function UpdateManuallyReview(fileName, path, learningPathFile, learningPathLineNumber, lineNumber = undefined)
{
manuallyReview.add(AssembleOutput(fileName, path, undefined, lineNumber, undefined, learningPathFile, learningPathLineNumber))
}

function UpdateOutOfSync(link, learningPathFile)
{
outOfSync.add(link + separator + BoldedText(learningPathFile))
}

function UpdateSuggestions(fileName, oldPath, newPath, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumber)
{
suggestions.add(AssembleOutput(fileName, oldPath, newPath, oldLineNumber, newLineNumber, learningPathFile, learningPathLineNumber))
}

function CreateLink(fileName, path, lineNumber)
{
var codeFileLink = "[" + fileName + "]" + "(" + path + ")"
return AppendLineNumber(codeFileLink, lineNumber)
}

function AssembleOutput(fileName, oldPath, newPath, oldLineNumber, newLineNumber, learningPathFile, learningPathLineNumber)
{
var codeFileLink = CreateLink(fileName, oldPath, oldLineNumber)

if (newPath && newLineNumber) {
codeFileLink += oldNewLinkSeparator + CreateLink(fileName, newPath, newLineNumber)
}

return codeFileLink + separator + BoldedText(AppendLineNumber(learningPathFile, learningPathLineNumber, undefined));
}

function AppendLineNumber(text, lineNumber)
{
if (!lineNumber) { return text }

return text + " " + linePrefix + lineNumber
}

function CheckForEndOfLink(str, startIndex)
{
const illegalCharIndex = str.substr(startIndex).search(/[\>\])\s]|$|.$|.\s/m); // This regex isn't perfect, but should cover most cases.
return illegalCharIndex;
}

function StripLineNumber(link, linePrefixIndex)
{
return link.substring(0, linePrefixIndex);
}

function GetContent(path) {
try {
return fs.readFileSync(path, 'utf8');
}
catch (error) {}

return undefined;
}

function ConstructOutputText(core)
{
var body = "";

if (manuallyReview.size > 0) { body += "<h2>Manually Review:</h2>" + Array.from(manuallyReview).join("<br />") + "<br />"; }

if (outOfSync.size > 0) { body += "<h2>Links With Out Of Sync Commit Hashes:</h2>" + Array.from(outOfSync).join("<br />") + "<br />"; }

if (suggestions.size > 0) { body += "<h2>Auto-Applied Suggestions:</h2>" + Array.from(suggestions).join("<br />") + "<br />"; }

if (modifiedFiles.size > 0) { body += "<h2>Modified Files:</h2>" + Array.from(modifiedFiles).join("<br />") + "<br />"; }

console.log("body=" + body);
core.setOutput('outputText', body);
}

function ValidateLinks(learningPathContents, repoURLToSearch, modifiedPRFiles, learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray)
{
// Get all indices where a link to the repo is found within the current learning path file
var linkIndices = [];
for(var pos = learningPathContents.indexOf(repoURLToSearch); pos !== -1; pos = learningPathContents.indexOf(repoURLToSearch, pos + 1)) {
linkIndices.push(pos);
}

for(let startOfLink of linkIndices)
{
// Clean up the link, determine if it has a line number suffix
let endOfLink = startOfLink + CheckForEndOfLink(learningPathContents, startOfLink)
if (endOfLink < startOfLink) { endOfLink = learningPathContents.length; } // If no illegal characters are found, the link is at the end of the file

const link = learningPathContents.substring(startOfLink, endOfLink);

if (excludeLinksArray.some(excludeLink => link.toLowerCase().includes(excludeLink))) { continue; }

const pathStartIndex = link.indexOf(sourceDirectoryName);

if (pathStartIndex === -1) { continue }

if (!link.includes(oldHash))
{
UpdateOutOfSync(link, learningPathFile);
continue
}

const linePrefixIndex = link.indexOf(linePrefix);
const linkHasLineNumber = linePrefixIndex !== -1;
const pathEndIndex = linkHasLineNumber ? linePrefixIndex : endOfLink;

// Check if the file being referenced by the link is one of the modified files in the PR
const linkFilePath = link.substring(pathStartIndex, pathEndIndex);
if (modifiedPRFiles.includes(linkFilePath))
{
const fileName = linkFilePath.substring(linkFilePath.lastIndexOf('/') + 1);

UpdateModifiedFiles(fileName, linkHasLineNumber ? StripLineNumber(link, linePrefixIndex) : link, learningPathFile);

// This is the line number in the learning path file that contains the link - not the #L line number in the link itself
const learningPathLineNumber = learningPathContents.substring(0, startOfLink).split("\n").length;

var headContent = GetContent(linkFilePath)
if (!headContent) {
UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber);
continue
}
const headContentLines = headContent.toString().split("\n");

if (!linkHasLineNumber) { continue; }
const oldLineNumber = Number(link.substring(linePrefixIndex + linePrefix.length, link.length));

var prevContent = GetContent(prevPathPrefix + linkFilePath)
if (!prevContent) { continue; }
const prevContentLines = prevContent.toString().split("\n");

if (prevContentLines.length < oldLineNumber)
{
UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, oldLineNumber);
}
else if (headContentLines.length < oldLineNumber || prevContentLines[oldLineNumber - 1].trim() !== headContentLines[oldLineNumber - 1].trim())
{
const newLineNumberLast = headContentLines.lastIndexOf(prevContentLines[oldLineNumber - 1]) + 1;
const newLineNumberFirst = headContentLines.indexOf(prevContentLines[oldLineNumber - 1]) + 1;

if (newLineNumberLast !== newLineNumberFirst) // Multiple matches found in the file
{
UpdateManuallyReview(fileName, link, learningPathFile, learningPathLineNumber, oldLineNumber);
}
else
{
let updatedLink = StripLineNumber(link.replace(oldHash, newHash), linePrefixIndex) + linePrefix + newLineNumberFirst;
UpdateSuggestions(fileName, link, updatedLink, learningPathFile, learningPathLineNumber, oldLineNumber, newLineNumberFirst);
}
}
}
}
}

const main = async () => {

const [core] = await actionUtils.installAndRequirePackages("@actions/core");

try {
const learningPathDirectory = core.getInput('learningPathsDirectory', { required: true });
const repoURLToSearch = core.getInput('repoURLToSearch', { required: true });
const changedFilePaths = core.getInput('changedFilePaths', {required: false});
const learningPathHashFile = core.getInput('learningPathHashFile', { required: true });
const sourceDirectoryName = core.getInput('sourceDirectoryName', { required: true });
const oldHash = core.getInput('oldHash', { required: true });
const newHash = core.getInput('newHash', { required: true });
const excludeLinks = core.getInput('excludeLinks', { required: false });
const excludeLinksArray = excludeLinks ? excludeLinks.split(',').map(function(item) { return item.toLowerCase().trim() }) : [];

if (changedFilePaths === null || changedFilePaths.trim() === "") { return }

// Scan each file in the learningPaths directory
fs.readdir(learningPathDirectory, (_, files) => {
files.forEach(learningPathFile => {
try {
const learningPathContents = GetContent(path.join(learningPathDirectory, learningPathFile))
if (learningPathContents)
{
ValidateLinks(learningPathContents, repoURLToSearch, changedFilePaths.split(' '), learningPathFile, oldHash, newHash, sourceDirectoryName, excludeLinksArray)
ConstructOutputText(core);
}
} catch (error) {
console.log("Error: " + error)
console.log("Could not find learning path file: " + learningPathFile)
}
});
});

fs.writeFileSync(learningPathHashFile, newHash);

// Scan each file in the learningPaths directory
fs.readdir(learningPathDirectory, (_, files) => {

files.forEach(learningPathFile => {
try {
const fullPath = path.join(learningPathDirectory, learningPathFile)
let content = fs.readFileSync(fullPath, 'utf8')

let suggestionsArray = Array.from(suggestions);
if (suggestionsArray && suggestionsArray.length > 0) {
suggestionsArray.forEach(suggestion => {
const suggestionArray = suggestion.split(oldNewLinkSeparator)
var oldLink = suggestionArray[0]
var newLink = suggestionArray[1]
oldLink = oldLink.substring(oldLink.indexOf('(') + 1, oldLink.lastIndexOf(')'))
newLink = newLink.substring(newLink.indexOf('(') + 1, newLink.lastIndexOf(')'))
content = ReplaceOldWithNewText(content, oldLink, newLink)
})
}

content = ReplaceOldWithNewText(content, oldHash, newHash)
fs.writeFileSync(fullPath, content);
} catch (error) {
console.log("Error: " + error)
console.log("Could not find learning path file: " + learningPathFile)
}
});
});

} catch (error) {
core.setFailed(error.message);
}
}

// Call the main function to run the action
main();
15 changes: 11 additions & 4 deletions .github/actions/open-pr/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ inputs:
fail_if_files_unchanged:
description: 'Fails the action if all of the specified files_to_commit are unchanged.'
required: false
always_create_pr:
description: 'Always try to create a PR, even if there are no uncommitted changes.'
required: false
update_if_already_exists:
description: 'Allows updating an existing PR, or re-opening it if closed.'
required: false
Expand All @@ -49,8 +52,8 @@ runs:

base_branch_name=${BASE_BRANCH_NAME:-${current_branch_name}}

git config user.name "github-actions"
git config user.email "github-actions@github.com"
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add ${{ inputs.files_to_commit }}

are_files_changed=""
Expand All @@ -61,10 +64,13 @@ runs:
exit 1
fi

exit 0
if [[ "$ALWAYS_CREATE_PR" != "true" ]]; then
exit 0
fi
else
git commit -m "$COMMIT_MESSAGE"
fi

git commit -m "$COMMIT_MESSAGE"
git push --force --set-upstream origin "HEAD:$pr_branch_name"

extraArgs=""
Expand All @@ -81,6 +87,7 @@ runs:
COMMIT_MESSAGE: ${{ inputs.commit_message }}
DRAFT: ${{ inputs.draft }}
LABELS: ${{ inputs.labels }}
ALWAYS_CREATE_PR: ${{ inputs.always_create_pr }}
FAIL_IF_FILES_UNCHANGED: ${{ inputs.fail_if_files_unchanged }}
UPDATE_IF_ALREADY_EXISTS: ${{ inputs.update_if_already_exists }}
TITLE: ${{ inputs.title }}
Expand Down
Loading