diff --git a/README.md b/README.md index fa9e761..1a9434a 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,11 @@ Output Type - `console` (default), `file` or `both`. `both` will output the coverage summary to the Action log and a file as above. +### `prfiles` + +Only analyse added/changed files - string of filenames or false. + + ### `thresholds` Lower and upper threshold percentages for badge and health indicators, lower threshold can also be used to fail the action. Separate the values with a space and enclose them in quotes; default `'50 75'`. diff --git a/action.yml b/action.yml index bb3ee76..1f78023 100644 --- a/action.yml +++ b/action.yml @@ -1,6 +1,6 @@ -name: 'Code Coverage Summary' -author: 'Irongut ' -description: 'A GitHub Action that reads Cobertura format code coverage files and outputs a text or markdown summary.' +name: 'Code Coverage Summary For Only Files In PR' +author: 'Irongut forked by ChkltLabs ' +description: 'Reads Cobertura format code coverage files and outputs a text or markdown summary, filterable to the current PR' branding: icon: book-open color: purple @@ -36,6 +36,10 @@ inputs: description: 'Output Type - console (default), file or both.' required: false default: 'console' + prfiles: + description: 'Only analyse added/changed files - string or false.' + required: false + default: 'false' thresholds: description: 'Threshold percentages for badge and health indicators, lower threshold can also be used to fail the action.' required: false diff --git a/src/CodeCoverageSummary/CommandLineOptions.cs b/src/CodeCoverageSummary/CommandLineOptions.cs index f525a9f..ca1be01 100644 --- a/src/CodeCoverageSummary/CommandLineOptions.cs +++ b/src/CodeCoverageSummary/CommandLineOptions.cs @@ -31,6 +31,11 @@ public class CommandLineOptions public string HideComplexityString { get; set; } public bool HideComplexity => HideComplexityString.Equals("true", StringComparison.OrdinalIgnoreCase); + + [Option(longName: "prfiles", Required = false, HelpText = "Only analyse added/changed files - string or false.", Default = "false")] + public string PRFilesOnlyString { get; set; } + + public bool PRFilesOnly => !PRFilesOnlyString.Equals("false", StringComparison.OrdinalIgnoreCase); [Option(longName: "indicators", Required = false, HelpText = "Include health indicators in the output - true or false.", Default = "true")] public string IndicatorsString { get; set; } diff --git a/src/CodeCoverageSummary/Program.cs b/src/CodeCoverageSummary/Program.cs index f0cc63f..dcfe403 100644 --- a/src/CodeCoverageSummary/Program.cs +++ b/src/CodeCoverageSummary/Program.cs @@ -41,6 +41,13 @@ private static int Main(string[] args) return -2; // error } } + + //if limiting to PR files, get list now + if (o.PRFilesOnly) + { + Console.WriteLine(o.PRFilesOnlyString); + return -2; + } // parse code coverage file CodeSummary summary = new();