Skip to content

Commit

Permalink
Merge pull request #4102 from schmittjoseph/merge-main-into-release/8.x
Browse files Browse the repository at this point in the history
Merge `main` into `release/8.x`
  • Loading branch information
schmittjoseph authored Mar 30, 2023
2 parents d5e05a8 + 7e207fc commit 8fd1295
Show file tree
Hide file tree
Showing 116 changed files with 2,302 additions and 387 deletions.
46 changes: 15 additions & 31 deletions .github/actions/AppendToFile/index.js
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
const util = require("util");
const fs = require('fs');
const actionUtils = require('../action-utils.js');
const path = require('path')

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

const jsExec = util.promisify(require("child_process").exec);

console.log("Installing npm dependencies");
const { stdout, stderr } = await jsExec("npm install @actions/core");
console.log("npm-install stderr:\n\n" + stderr);
console.log("npm-install stdout:\n\n" + stdout);
console.log("Finished installing npm dependencies");

const core = require('@actions/core');

try {
try {
const textToSearch = core.getInput('textToSearch', { required: true });
const textToAdd = core.getInput('textToAdd', { required: true });
const paths = core.getInput('paths', {required: false});
Expand All @@ -25,31 +15,25 @@ async function main() {
{
return;
}

console.log("Paths: " + paths);

for (const currPath of paths.split(',')) {
fs.readFile(currPath, (err, content) => {
if (err)
const content = await actionUtils.readFile(currPath);
if (content && !content.includes(textToSearch))
{
var updatedTextToAdd = textToAdd;
if (textToAdd.includes(insertFileNameParameter))
{
console.log(err);
const parsedPath = path.parse(currPath);
const encodedURIWithoutExtension = encodeURIComponent(path.join(parsedPath.dir, parsedPath.name))
updatedTextToAdd = textToAdd.replace(insertFileNameParameter, encodedURIWithoutExtension);
}

if (content && !content.includes(textToSearch))
{
var updatedTextToAdd = textToAdd;
if (textToAdd.includes(insertFileNameParameter))
{
const parsedPath = path.parse(currPath);
const encodedURIWithoutExtension = encodeURIComponent(path.join(parsedPath.dir, parsedPath.name))
updatedTextToAdd = textToAdd.replace(insertFileNameParameter, encodedURIWithoutExtension);
}

var contentStr = updatedTextToAdd + "\n\n" + content.toString();
var contentStr = updatedTextToAdd + "\n\n" + content.toString();

fs.writeFile(currPath, contentStr, (err) => {});
}
});
await actionUtils.writeFile(currPath, contentStr);
}
}
} catch (error) {
core.setFailed(error.message);
Expand Down
22 changes: 22 additions & 0 deletions .github/actions/action-utils.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const util = require("util");
const fs = require("fs");
const jsExec = util.promisify(require("child_process").exec);

module.exports.installAndRequirePackages = async function(...newPackages)
{
console.log("Installing npm dependency");
const { stdout, stderr } = await jsExec(`npm install ${newPackages.join(' ')}`);
console.log("npm-install stderr:\n\n" + stderr);
console.log("npm-install stdout:\n\n" + stdout);
console.log("Finished installing npm dependencies");

let requiredPackages = [];
for (const packageName of newPackages) {
requiredPackages.push(require(packageName));
}

return requiredPackages;
}

module.exports.readFile = (fileName) => util.promisify(fs.readFile)(fileName, 'utf8');
module.exports.writeFile = (fileName, contents) => util.promisify(fs.writeFile)(fileName, contents);
19 changes: 4 additions & 15 deletions .github/actions/generate-release-notes/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
const fs = require('fs');
const actionUtils = require('../action-utils.js');
const path = require('path');
const util = require('util');
const jsExec = util.promisify(require("child_process").exec);
const readFile = (fileName) => util.promisify(fs.readFile)(fileName, 'utf8');
const writeFile = (fileName, contents) => util.promisify(fs.writeFile)(fileName, contents);

const UpdateReleaseNotesLabel = "update-release-notes";
const BackportLabel = "backport";

async function run() {
console.log("Installing npm dependencies");
const { stdout, stderr } = await jsExec("npm install @actions/core @actions/github");
console.log("npm-install stderr:\n\n" + stderr);
console.log("npm-install stdout:\n\n" + stdout);
console.log("Finished installing npm dependencies");

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

const octokit = github.getOctokit(core.getInput("auth_token", { required: true }));

Expand Down Expand Up @@ -47,7 +36,7 @@ async function run() {
const monikerDescriptions = generateMonikerDescriptions(significantLabels);

const releaseNotes = await generateReleaseNotes(path.join(__dirname, "releaseNotes.template.md"), buildDescription, changelog, monikerDescriptions);
await writeFile(output, releaseNotes);
await actionUtils.writeFile(output, releaseNotes);
} catch (error) {
core.setFailed(error);
}
Expand Down Expand Up @@ -166,7 +155,7 @@ async function generateChangelog(octokit, branch, repoOwner, repoName, minMergeD
}

async function generateReleaseNotes(templatePath, buildDescription, changelog, monikerDescriptions) {
let releaseNotes = await readFile(templatePath);
let releaseNotes = await actionUtils.readFile(templatePath);
releaseNotes = releaseNotes.replace("${buildDescription}", buildDescription);
releaseNotes = releaseNotes.replace("${changelog}", changelog);
releaseNotes = releaseNotes.replace("${monikerDescriptions}", monikerDescriptions);
Expand Down
2 changes: 1 addition & 1 deletion .github/dependabot.template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ updates:
schedule:
interval: "daily"
target-branch: "main"
#@ for branch in ["main", "release/7.x", "release/7.0", "release/6.x"]:
#@ for branch in ["main", "release/7.x", "release/7.1", "release/7.0", "release/6.x"]:
#@ commit_prefix = "[" + branch + "] "
- package-ecosystem: "nuget"
directory: "/eng/dependabot"
Expand Down
51 changes: 51 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,57 @@ updates:
- version-update:semver-major
commit-message:
prefix: '[release/7.x] '
- package-ecosystem: nuget
directory: /eng/dependabot
schedule:
interval: daily
target-branch: release/7.1
ignore:
- dependency-name: Microsoft.Extensions.*
update-types:
- version-update:semver-major
commit-message:
prefix: '[release/7.1] '
- package-ecosystem: nuget
directory: /eng/dependabot/nuget.org
schedule:
interval: daily
target-branch: release/7.1
commit-message:
prefix: '[release/7.1] '
- package-ecosystem: nuget
directory: /eng/dependabot/net7.0
schedule:
interval: daily
target-branch: release/7.1
ignore:
- dependency-name: '*'
update-types:
- version-update:semver-major
commit-message:
prefix: '[release/7.1] '
- package-ecosystem: nuget
directory: /eng/dependabot/net6.0
schedule:
interval: daily
target-branch: release/7.1
ignore:
- dependency-name: '*'
update-types:
- version-update:semver-major
commit-message:
prefix: '[release/7.1] '
- package-ecosystem: nuget
directory: /eng/dependabot/netcoreapp3.1
schedule:
interval: daily
target-branch: release/7.1
ignore:
- dependency-name: '*'
update-types:
- version-update:semver-major
commit-message:
prefix: '[release/7.1] '
- package-ecosystem: nuget
directory: /eng/dependabot
schedule:
Expand Down
Loading

0 comments on commit 8fd1295

Please sign in to comment.