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

Add dummy file to trigger. #1

Open
wants to merge 11 commits into
base: master
Choose a base branch
from
32 changes: 25 additions & 7 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14180,6 +14180,7 @@ module.exports = {

/* eslint-env node */

const path = __webpack_require__(622);
const core = __webpack_require__(470);
const glob = __webpack_require__(281);
const github = __webpack_require__(469);
Expand Down Expand Up @@ -14214,11 +14215,14 @@ function getArrayInput(value) {
}

function parseFile(file) {
console.log("Parsing file:", file);
const relPath = path.relative(".", file);
console.log("Parsing file:", relPath);

const translation = po2json.parseFileSync(file);
const language = translation[""].language.trim().toLowerCase();
const details = {
language,
path: relPath,
skipped: false,
messageCount: 0,
translatedMessageCount: 0,
Expand All @@ -14229,9 +14233,9 @@ function parseFile(file) {
(onlyLanguages.length > 0 && onlyLanguages.indexOf(language) === -1) ||
(ignoreLanguages.length > 0 && ignoreLanguages.indexOf(language) !== -1)
) {
console.log("Skipping file:", file);
console.log("Skipping file:", relPath);
details.skipped = true;
details.summary = ` - "${file}" skipped`;
details.summary = ` - "${relPath}" skipped`;
return details;
}

Expand All @@ -14245,7 +14249,7 @@ function parseFile(file) {
(details.translatedMessageCount / details.messageCount) *
100
).toFixed(2);
details.summary = ` - "${file}" translated ${details.coverage}% `;
details.summary = `${relPath} translated ${details.coverage}% `;
details.summary += `(${details.translatedMessageCount} / ${details.messageCount} messages)`;

console.log(details.summary);
Expand All @@ -14255,13 +14259,14 @@ function parseFile(file) {
async function main() {
const globber = await glob.create(translationPath);

let allSummaries = [];
const perFileDetails = {};
let totalMessages = 0;
let totalTranslatedMessages = 0;

(await globber.glob()).forEach((file) => {
const details = parseFile(file);
allSummaries.push(details.summary);

perFileDetails[details.language] = details;
totalMessages += details.messageCount;
totalTranslatedMessages += details.translatedMessageCount;
});
Expand Down Expand Up @@ -14299,7 +14304,20 @@ async function main() {
output: {
title: `${coverage.toFixed(0)}% i18n coverage.`,
summary: summary + `, min-coverage: ${minCoverage}%`,
text: allSummaries.join("\n"),
text: Object.values(perFileDetails)
.map((details) => " - " + details.summary)
.join("\n"),
annotations: Object.values(perFileDetails)
.filter((details) => !details.skipped)
.map((details) => {
return {
path: details.path,
start_line: 0,
end_line: 0,
annotation_level: "notice",
message: details.summary,
};
}),
},
});
}
Expand Down
169 changes: 33 additions & 136 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,13 @@
"@actions/core": "^1.2.4",
"@actions/github": "^3.0.0",
"@actions/glob": "^0.1.0",
"path": "^0.12.7",
"po2json": "^0.4.5"
},
"devDependencies": {
"@zeit/ncc": "^0.22.3",
"babel-eslint": "^10.1.0",
"eslint": "^7.2.0",
"eslint": "^7.3.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-prettier": "^3.1.4",
"lint-staged": "^10.2.11",
Expand Down
Loading