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 support for workflow_dispatch event, bump to node20 #145

Merged
merged 7 commits into from
Nov 15, 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
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog of the Pytest Coverage Comment

## [Pytest Coverage Comment 1.1.49](https://github.com/MishaKav/pytest-coverage-comment/tree/v1.1.49)

**Release Date:** 2023-11-15

#### Changes

- remove warning by run in `node20` instead `node16`
- add support for `workflow_dispatch` event, thanks to [@f100024](https://github.com/f100024) for contribution

## [Pytest Coverage Comment 1.1.48](https://github.com/MishaKav/pytest-coverage-comment/tree/v1.1.48)

**Release Date:** 2023-08-02
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,5 +120,5 @@ outputs:
description: 'Info from testcase that has failures/errors/skipped, get from `junitxml`'

runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'
61 changes: 39 additions & 22 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ class OidcClient {
.catch(error => {
throw new Error(`Failed to get ID Token. \n
Error Code : ${error.statusCode}\n
Error Message: ${error.result.message}`);
Error Message: ${error.message}`);
});
const id_token = (_a = res.result) === null || _a === void 0 ? void 0 : _a.value;
if (!id_token) {
Expand Down Expand Up @@ -11970,7 +11970,7 @@ function wrappy (fn, cb) {
// Generated by CoffeeScript 1.12.7
(function() {
"use strict";
var bom, defaults, events, isEmpty, processItem, processors, sax, setImmediate,
var bom, defaults, defineProperty, events, isEmpty, processItem, processors, sax, setImmediate,
bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; },
extend = function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
hasProp = {}.hasOwnProperty;
Expand Down Expand Up @@ -12000,6 +12000,16 @@ function wrappy (fn, cb) {
return item;
};

defineProperty = function(obj, key, value) {
var descriptor;
descriptor = Object.create(null);
descriptor.value = value;
descriptor.writable = true;
descriptor.enumerable = true;
descriptor.configurable = true;
return Object.defineProperty(obj, key, descriptor);
};

exports.Parser = (function(superClass) {
extend(Parser, superClass);

Expand Down Expand Up @@ -12063,13 +12073,13 @@ function wrappy (fn, cb) {
Parser.prototype.assignOrPush = function(obj, key, newValue) {
if (!(key in obj)) {
if (!this.options.explicitArray) {
return obj[key] = newValue;
return defineProperty(obj, key, newValue);
} else {
return obj[key] = [newValue];
return defineProperty(obj, key, [newValue]);
}
} else {
if (!(obj[key] instanceof Array)) {
obj[key] = [obj[key]];
defineProperty(obj, key, [obj[key]]);
}
return obj[key].push(newValue);
}
Expand Down Expand Up @@ -12110,21 +12120,21 @@ function wrappy (fn, cb) {
this.saxParser.onopentag = (function(_this) {
return function(node) {
var key, newValue, obj, processedKey, ref;
obj = Object.create(null);
obj = {};
obj[charkey] = "";
if (!_this.options.ignoreAttrs) {
ref = node.attributes;
for (key in ref) {
if (!hasProp.call(ref, key)) continue;
if (!(attrkey in obj) && !_this.options.mergeAttrs) {
obj[attrkey] = Object.create(null);
obj[attrkey] = {};
}
newValue = _this.options.attrValueProcessors ? processItem(_this.options.attrValueProcessors, node.attributes[key], key) : node.attributes[key];
processedKey = _this.options.attrNameProcessors ? processItem(_this.options.attrNameProcessors, key) : key;
if (_this.options.mergeAttrs) {
_this.assignOrPush(obj, processedKey, newValue);
} else {
obj[attrkey][processedKey] = newValue;
defineProperty(obj[attrkey], processedKey, newValue);
}
}
}
Expand Down Expand Up @@ -12195,7 +12205,7 @@ function wrappy (fn, cb) {
}
if (_this.options.explicitChildren && !_this.options.mergeAttrs && typeof obj === 'object') {
if (!_this.options.preserveChildrenOrder) {
node = Object.create(null);
node = {};
if (_this.options.attrkey in obj) {
node[_this.options.attrkey] = obj[_this.options.attrkey];
delete obj[_this.options.attrkey];
Expand All @@ -12210,10 +12220,10 @@ function wrappy (fn, cb) {
obj = node;
} else if (s) {
s[_this.options.childkey] = s[_this.options.childkey] || [];
objClone = Object.create(null);
objClone = {};
for (key in obj) {
if (!hasProp.call(obj, key)) continue;
objClone[key] = obj[key];
defineProperty(objClone, key, obj[key]);
}
s[_this.options.childkey].push(objClone);
delete obj["#name"];
Expand All @@ -12227,8 +12237,8 @@ function wrappy (fn, cb) {
} else {
if (_this.options.explicitRoot) {
old = obj;
obj = Object.create(null);
obj[nodeName] = old;
obj = {};
defineProperty(obj, nodeName, old);
}
_this.resultObject = obj;
_this.saxParser.ended = true;
Expand Down Expand Up @@ -16832,7 +16842,7 @@ const getNotSuccessTest = (options) => {
}
} catch (error) {
core.warning(
`Could not get notSuccessTestInfo successfully. ${error.message}`
`Could not get notSuccessTestInfo successfully. ${error.message}`,
);
}

Expand Down Expand Up @@ -17210,14 +17220,14 @@ const toTable = (data, options, dataFromXml = null) => {
}

const allFilesInFolder = Object.values(folders[folderPath]).map(
(f) => f.name
(f) => f.name,
);

folders[folderPath] = folders[folderPath].filter((f) =>
changedFiles.all.some((c) => c.includes(f.name))
changedFiles.all.some((c) => c.includes(f.name)),
);
const fileExistsInFolder = allFilesInFolder.some((f) =>
changedFiles.all.some((c) => c.includes(f))
changedFiles.all.some((c) => c.includes(f)),
);
return fileExistsInFolder;
})
Expand All @@ -17227,7 +17237,7 @@ const toTable = (data, options, dataFromXml = null) => {
toFolderTd(key, options),
...folders[key].map((file) => toRow(file, key !== '', options)),
],
[]
[],
);

const hasLines = rows.length > 0;
Expand Down Expand Up @@ -17822,7 +17832,7 @@ const main = async () => {
const hideComment = core.getBooleanInput('hide-comment', { required: false });
const reportOnlyChangedFiles = core.getBooleanInput(
'report-only-changed-files',
{ required: false }
{ required: false },
);
const removeLinkFromBadge = core.getBooleanInput('remove-link-from-badge', {
required: false,
Expand Down Expand Up @@ -17870,6 +17880,7 @@ const main = async () => {
xmlTitle,
multipleFiles,
};

options.repoUrl =
payload.repository?.html_url || `https://github.com/${options.repository}`;

Expand All @@ -17880,6 +17891,9 @@ const main = async () => {
} else if (eventName === 'push') {
options.commit = payload.after;
options.head = context.ref;
} else if (eventName === 'workflow_dispatch') {
options.commit = context.sha;
options.head = context.ref;
}

if (options.reportOnlyChangedFiles) {
Expand Down Expand Up @@ -17931,7 +17945,8 @@ const main = async () => {

if (
!options.hideReport &&
html.length + summaryReport.length > MAX_COMMENT_LENGTH
html.length + summaryReport.length > MAX_COMMENT_LENGTH &&
eventName != 'workflow_dispatch'
) {
// generate new html without report
// prettier-ignore
Expand Down Expand Up @@ -18029,10 +18044,12 @@ const main = async () => {
});
}
}
} else if (eventName === 'workflow_dispatch') {
await core.summary.addRaw(body, true).write();
} else {
if (!options.hideComment) {
// prettier-ignore
core.warning(`This action supports comments only on \`pull_request\`, \`pull_request_target\` and \`push\` events. \`${eventName}\` events are not supported.\nYou can use the output of the action.`)
core.warning(`This action supports comments only on \`pull_request\`, \`pull_request_target\`, \`push\` and \`workflow_dispatch\` events. \`${eventName}\` events are not supported.\nYou can use the output of the action.`)
}
}
};
Expand Down Expand Up @@ -18091,7 +18108,7 @@ const getChangedFiles = async (options) => {
if (response.status !== 200) {
core.setFailed(
`The GitHub API for comparing the base and head commits for this ${eventName} event returned ${response.status}, expected 200. ` +
"Please submit an issue on this action's GitHub repo."
"Please submit an issue on this action's GitHub repo.",
);
}

Expand Down
Loading