Added the ability to replace some placeholders in the screeps code #12

Merged
Philipp merged 7 commits from added-read-replace-git into main 2023-12-25 02:22:44 +01:00
3 changed files with 135 additions and 2 deletions
Showing only changes of commit 3b63dda1d8 - Show all commits

View File

@ -19,12 +19,10 @@ const path = require("path");
*/
function replacePlaceholders(content) {
const deployTime = new Date().toISOString();
content = content
return content
.replace(/{{gitHash}}/g, process.env.GITHUB_SHA)
.replace(/{{gitRef}}/g, process.env.GITHUB_REF)
.replace(/{{deployTime}}/g, deployTime);
core.info(content);
return content;
}
/**
@ -41,8 +39,6 @@ function replacePlaceholders(content) {
async function readReplaceAndWriteFiles(pattern, prefix) {
return new Promise((resolve, reject) => {
const globPattern = prefix ? path.join(prefix, pattern) : pattern;
core.info("globPattern");
core.info(globPattern);
glob(globPattern, async (err, files) => {
if (err) {