Skip to content

Commit

Permalink
Added check for build/lint workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
RubenMuellauer committed Oct 25, 2024
1 parent f48c04a commit aa1f50c
Show file tree
Hide file tree
Showing 5 changed files with 403 additions and 334 deletions.
63 changes: 46 additions & 17 deletions UI5_Quality_Checks_App/webapp/controller/startpage.controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ sap.ui.define(["sap/ui/core/mvc/Controller"], function (Controller) {
resultsList.setVisible(true);
loginBox.setVisible(false);

var linter = await SRBGitHub.getLatestLintWorkflowRun();
this.fetchData(linter);
var allResponses = await SRBGitHub.getLatestLintWorkflowRun();
this.fetchData(allResponses);
},

fetchData: async function (linter) {
Expand All @@ -100,46 +100,64 @@ sap.ui.define(["sap/ui/core/mvc/Controller"], function (Controller) {
repoUrl: "https://github.com/" + repoResult.repository.owner.login + "/" + repoResult.repository.name,
filename: repoResult.path,
fileUrl: repoResult.html_url,
owner: repoResult.repository.owner.login
owner: repoResult.repository.owner.login,
repository: repoResult.repository
};

var file = await SRBGitHub.getFileOfRepo(repoResult.repository.name, repoResult.path, repoResult.repository.owner.login);
var version = await SRBGitHub.detectUI5VersionInFileV2(file);

linter.forEach((lint) => {
for (const lint of linter) {
if (lint) {
if (repoResult.repository.name === lint.head_repository.name) version.linter = lint;
if (repoResult.repository.name === lint.head_repository.name) {
version.linter = lint;
var latestJobs = await SRBGitHub.getLatestLintWorkflowJob(repoResult.repository.name, lint.id);
for (const job of latestJobs) {
if (job.name.includes("linter")) version.allLintJobs.push(job);
else if (job.name.includes("build")) version.allBuildJobs.push(job);
}
}
}
});
}
if (version.isMinVersion === true) {
noVersionFound.push(repoResult.repository.name);
} else {
that.setResultData(resultRecord, version, file, false);
that.addRow(resultRecord);
}
}

return noVersionFound;
},

fetchManifestData: async function (manifestFiles, linter) {
var that = this;

for (const manifestResult of manifestFiles) {
var resultRecord = {
repo: manifestResult.repository.name,
repoUrl: "https://github.com/" + manifestResult.repository.owner.login + "/" + manifestResult.repository.name,
filename: manifestResult.path,
fileUrl: manifestResult.html_url,
owner: manifestResult.repository.owner.login
owner: manifestResult.repository.owner.login,
repository: manifestResult.repository
};

var file = await SRBGitHub.getFileOfRepo(manifestResult.repository.name, manifestResult.path, manifestResult.repository.owner.login);
var version = await SRBGitHub.detectUI5VersionInManifestFile(file);

linter.forEach((lint) => {
for (const lint of linter) {
if (lint) {
if (manifestResult.repository.name === lint.head_repository.name) version.linter = lint;
if (manifestResult.repository.name === lint.head_repository.name) {
version.linter = lint;
var latestJobs = await SRBGitHub.getLatestLintWorkflowJob(manifestResult.repository.name, lint.id);
for (const job of latestJobs) {
if (job.name.includes("linter")) version.allLintJobs.push(job);
else if (job.name.includes("build")) version.allBuildJobs.push(job);
}
}
}
});
}
that.setResultData(resultRecord, version, file, true);

that.addRow(resultRecord);
Expand All @@ -157,6 +175,10 @@ sap.ui.define(["sap/ui/core/mvc/Controller"], function (Controller) {
resultRecord["eocp"] = versionInfo.eocp;
resultRecord["eom"] = versionInfo.eom;
resultRecord["linter"] = versionInfo.linter;
resultRecord["allBuildJobs"] = versionInfo.allBuildJobs;
resultRecord["allLintJobs"] = versionInfo.allLintJobs;

// console.log(resultRecord);

if (versionInfo.eocp === true) {
problematic = true;
Expand Down Expand Up @@ -216,14 +238,9 @@ sap.ui.define(["sap/ui/core/mvc/Controller"], function (Controller) {
});
},

tableFilterButtonPressed: function (oEvent) {
var resultsTable = this.getView().byId("resultsTable");
TableUtils.filter.openFilterDialog(resultsTable);
},

tableSortButtonPressed: function (oEvent) {
var resultsTable = this.getView().byId("resultsTable");
TableUtils.sort.openSortDialog(resultsTable, oEvent.getSource());
var resultsList = this.getView().byId("list");
TableUtils.sort.openSortDialog(this.resultsModel, oEvent.getSource());
},

getRepoDialogContent: function (listRecord) {
Expand Down Expand Up @@ -302,6 +319,18 @@ sap.ui.define(["sap/ui/core/mvc/Controller"], function (Controller) {
);
}
}
},

onSearch: function (oEvent) {
var aFilters = [];
var query = oEvent.getSource().getValue();
if (query && query.length > 0) {
var filter = new sap.ui.model.Filter("repo", sap.ui.model.FilterOperator.Contains, query);
aFilters.push(filter);
}

var list = this.getView().byId("list");
list.getBinding("items").filter(aFilters, "Application");
}
});
});
4 changes: 4 additions & 0 deletions UI5_Quality_Checks_App/webapp/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@
font-size: 90%;
font-weight: bold;
}

.boldText {
font-weight: bold;
}
25 changes: 23 additions & 2 deletions UI5_Quality_Checks_App/webapp/libs/SRBGitHub.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ var SRBGitHub = (function () {
per_page: 100
});

console.log(response);

return { results: response.data.items, headers: response.headers };
},

Expand Down Expand Up @@ -137,7 +139,11 @@ var SRBGitHub = (function () {
isEvergreenBootstrap: evergreen,
eocp: eocp, // <-- If true, it has already been removed
eom: eom,
linter: undefined
linter: undefined,
allBuildJobs: [],
buildSuccess: undefined,
lintSuccess: undefined,
allLintJobs: []
};
},

Expand Down Expand Up @@ -186,7 +192,9 @@ var SRBGitHub = (function () {
isEvergreenBootstrap: false,
eocp: eocp, // <-- If true, it has already been removed
eom: eom,
linter: undefined
linter: undefined,
allBuildJobs: [],
allLintJobs: []
};
},

Expand Down Expand Up @@ -215,9 +223,22 @@ var SRBGitHub = (function () {
allResponses.push(response.data.workflow_runs[0]);
}

// console.log(allResponses);

return allResponses;
},

getLatestLintWorkflowJob: async function (repoName, runId) {
var that = this;
var job = await that.octokit.rest.actions.listJobsForWorkflowRun({
owner: "SRBConsultingTeam",
repo: repoName,
run_id: runId

Check failure on line 236 in UI5_Quality_Checks_App/webapp/libs/SRBGitHub.js

View workflow job for this annotation

GitHub Actions / srb-reuse-linter / js-linter-job

Identifier 'run_id' is not in camel case
});

return job.data.jobs;
},

getAvailableRepos: function () {
var that = this;

Expand Down
Loading

0 comments on commit aa1f50c

Please sign in to comment.