Skip to content
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

Adds more logging and null check to WIKI Updater #1570

Merged
merged 10 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
24 changes: 24 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/typescript-node
{
"name": "Node.js & TypeScript",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/typescript-node:1-20-bullseye",
// Configure tool-specific properties.
"customizations": {
"vscode": {
"extensions": [
"github.vscode-pull-request-github",
"github.copilot"
]
}
},
// Commands to be run after the container is created.
"postCreateCommand": [
"echo 'Add PWSH'",
"wget -q https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb",
"sudo dpkg -i packages-microsoft-prod.deb",
"sudo apt-get update",
"sudo apt-get install -y powershell"
]
}
6 changes: 6 additions & 0 deletions Extensions/WikiUpdater/WikiUpdaterTask/src/GitWikiFuntions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ export async function UpdateGitWikiFile(
mode) {
const git = simpleGit();

// show error if content is null
if (!contents) {
logError(`The new content is null, so cannot be used to update the wiki`);
return;
}

let remote = "";
let logremote = ""; // used to make sure we hide the password in logs
var extraHeaders = []; // Add handling for #613
Expand Down
2 changes: 2 additions & 0 deletions Extensions/WikiUpdater/WikiUpdaterTask/src/GitWikiTask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ var haveData = true;
var contents; // we late declare as it might be buffer or string
if (dataIsFile === true) {
if (fs.existsSync(sourceFile)) {
logInfo(`Reading file ${sourceFile}`);
if (fixLineFeeds) {
contents = fs.readFileSync(sourceFile, "utf8");
} else {
Expand All @@ -106,6 +107,7 @@ if (dataIsFile === true) {
}
} else {
// we do this late copy so that we can use the same property for different encodings with a type clash
logInfo(`Using contents string directly input`);
contents = contentsInput;
}

Expand Down
Loading