Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:TheCacophonyProject/saltops into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
CameronRP committed Oct 1, 2024
2 parents 8c36a51 + 0496be4 commit 2f36dae
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion .github/workflows/aggregate-versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,22 @@ const versionsAreEqual = (prev, next) => {
}
return true;
};
const latestCommitDate = async (branch) => {
try {
console.log("Getting latest commit date for ", branch);
const response = await fetch(`https://api.github.com/repos/TheCacophonyProject/saltops/commits?sha=${branch}&per_page=1`);
if (!response.ok) {
throw new Error(`Response status: ${response.status}`);
}

const commitJson = await response.json();
const commitDate = commitJson[0]["commit"]["author"]["date"]
return commitDate
} catch (error) {
console.error("Error getting latest commit date ",error.message);
}
return "";
}
(async function () {
const versionData = {};
console.log(process.cwd());
Expand All @@ -77,11 +93,13 @@ const versionsAreEqual = (prev, next) => {
// For each branch:
versionData[branch] = {};
process.chdir(`./${branch}`);
const commitDate = await latestCommitDate(branch)
console.log("Got commit date",commitDate);
for (const model of models) {
// For each camera model:
process.chdir(`./${model}`);
const slsFiles = getFilesWithExtension(".", "sls");
versionData[branch][model] = {};
versionData[branch][model] = {"commitDate":commitDate};
for (const path of slsFiles) {
const data = fs.readFileSync(path, "utf8");
try {
Expand Down

0 comments on commit 2f36dae

Please sign in to comment.