Skip to content
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
1 change: 1 addition & 0 deletions .github/actions/reports-group/.nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
20

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const core = require("@actions/core"); // @TODO move to 'imports from' when moved to TS !

if (!!core.getState('check-run-id')) {
if (!!core.getState('has-been-triggered')) {
require('./src/cleanup');
} else {
require('./src/main');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ async function run() {
core.debug('API params=' + JSON.stringify(requestParams));

const apiResponse = await core.group('Conclude check-run ', async () => {
/** @type {OctokitInterface} */
const octokit = github.getOctokit(githubToken);

// @TODO Move back to `octokit.rest.checks.update()`
Expand All @@ -39,4 +40,5 @@ async function run() {
core.debug('API call to ' +apiResponse.url + ' => HTTP ' + apiResponse.status);
}

// No need to wrap cleanup with try/catch, error are ignored anyway
run();
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,15 @@ const ghaHelpers = require('../node-gha-helpers');
const formatMarkdownUrl = (title, link) => '<a href="' + link + '" target="blank">' + title + '</a>';

async function run() {
core.saveState('has-been-triggered', 1);
/** INPUTS **/
const githubToken = core.getInput('github-token', {required: true});
const jobStatus = core.getInput('job-status', {required: true});
const checkName = core.getInput('name');
const failsOnTriggeringWorkflowFailure = core.getBooleanInput('fails-on-triggering-workflow-failure', {required: true});

const isSuccessfulJobAsOfNow = 'success' === jobStatus;
const octokit = getOctokit(githubToken);
const octokit = /** @type {OctokitInterface} */getOctokit(githubToken);

const requestParams = await core.group(
'Build API params',
Expand Down Expand Up @@ -70,4 +71,7 @@ async function run() {
}
}

run();
run().catch(e => {
core.warning('Error caught and ignored ' + e.message);
core.debug('Error=' + JSON.stringify(e));
});
4 changes: 2 additions & 2 deletions .github/actions/reports-group/create-action/dist/index.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion .github/actions/reports-group/create-action/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ async function run() {
return res;
}
);
core.debug('outputs=' + JSON.stringify(outputs));
SDK.outputs.bindFrom(outputs);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: TODO
inputs:
from-triggering-workflow:
description: |
Weither to look for triggering workflow context or just current workflow context (default `true` !).
Whether to look for triggering workflow context or just current workflow context (default `true` !).
- True: In case current workflow event is `workflow_run`, the context of the workflow which **triggered** the current one will be returned. Else returns the current workflow context
- False: Return the context for the current workflow.
required: false
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

235 changes: 233 additions & 2 deletions .github/actions/reports-group/find-action/action.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,248 @@
name: find
description: |
Find reports group directory under the provided `path`
Find reports group directory under the provided `path`.

Assuming your reports group are located at `build/reports-groups` and the uploader action expect a comma separated list of items
# Find all reports group to manage, grouped by format and flags

```yaml
prepare:
name: Prepare upload
runs-on: ubuntu-latest
outputs:
matrix: $\{{ steps.upload.outputs.matrix }} # See job "Upload" below
groups: $\{{ steps.upload.outputs.paths }} # List of path to reports group directories
permissions:
contents: read
checks: write # For the check run creation ! @TODO check if doable to use inputs there and set read rather than write if $\{{ !inputs.with-check-run }}
steps:
# ... fetch data (checkout, artefacts, etc)

- uses: ./custom-action-repo/.github/actions/reports-group/attach-check-run-to-triggering-workflow-action
if: $\{{ 'workflow_run' == github.event_name }}
with:
github-token: $\{{ github.token }}
job-status: $\{{ job.status }}
- name: Find reports groups
id: find-groups
uses: reports-group/find-action@v0.1.0
with:
path: build/reports-groups
#format: string # default value
glue-string: ','
group-by: |
format
flags
matrix-mode: true
#artifacts-mode: true # Uncomment if `build/reports-groups` is the directoy used to fecth artefacts
#follow-symbolic-links: false # default value
upload:
name: Upload groups
runs-on: ubuntu-latest
outputs:
matrix: $\{{ steps.upload.outputs.matrix }} # See job "Upload" below
groups: $\{{ steps.upload.outputs.paths }} # List of path to reports group directories
permissions:
contents: read
checks: write # For the check run creation ! @TODO check if doable to use inputs there and set read rather than write if `!inputs.with-check-run`
steps:
# ... fetch data (checkout, artefacts, etc)

- uses: ./custom-action-repo/.github/actions/reports-group/attach-check-run-to-triggering-workflow-action
if: $\{{ 'workflow_run' == github.event_name }}
with:
github-token: $\{{ github.token }}
job-status: $\{{ job.status }}
- name: Find reports groups
id: find-groups
uses: reports-group/find-action@v0.1.0
with:
path: build/reports-groups
#format: string # default value
glue-string: ','
group-by: format,flags
matrix-mode: true
#artifacts-mode: true # Uncomment if `build/reports-groups` is the directoy used to fecth artefacts
#follow-symbolic-links: false # default value
```

# Group by format
In order to use metadata list as contexts for a job matrix, add `matrix-mode: true`. See `matrix-mode` description

# Job matrix
In order to use metadata list as contexts for a job matrix, add `matrix-mode: true`. See `matrix-mode` description


inputs:
path:
description: A group directory, or a glob pattern in order to find underlying group directories
required: true
format:
description: |
`string` (default), `glob-string` or `json`
- Format `json` is the base output format and produces the following metadata shape:
- Property `name`: JSON list of unique `metadata.name` values.
- Property `format`: JSON list of unique `metadata.format` values.
- Property `reports`: JSON list of unique `metadata.reports` paths.
In case `artifacts-mode` is enabled, paths are relative paths starting with the artifact directory !
- Property `flags`: JSON list of unique `metadata.flags` values.
- Property `path`: JSON list of unique group paths (e.g. `metadata.path` values).
In case `artifacts-mode` is enabled, paths are relative paths starting with the artifact directory !
- Property `artifact`: JSON list of unique `metadata.artifact` values.
**Filled only if `artifacts-mode` is enabled !**

If you are looking to merge multiple group together into a single metadata, rely on reports-group/load-metadata-action instead. If you still
need to filter in & out and/or to group first, rely on this action and pass the `paths` output to reports-group/load-metadata-action `path` input.

- Format `string` produces the same metadata shape than `json` format, except that every property is joined with `glue-string`,
so every property is a string value.
And in case `artifacts-mode` is enabled, property `artifact` is a glob compatible multiline list of artifact name which can be use
as `pattern` when you have to deal with `actions/download-artifact !

It **requires `glue-string` to be filled !**

Note: "Merging phase" is performed **at the end of the process**

- Format `glob-string` produces the same metadata shape as `string` format, except that
properties `path` and `reports` are glob compatible multiline string values rather than simply joined with `glue-string`

It implies `string` format for non-path fields, therefore **requires `glue-string` to be filled !**
required: false
default: 'string'
glue-string:
description: String used to concatenate values.
required: false
# "Filtering" phases
forbidden-groups:
description: |
Multiline list of group name.
If filled, any group matching one of the list will be excluded.

Note: "Forbidden" phase is performed **at the beginning of the process**, before everything else.
required: false
default: ''
forbidden-formats:
description: |
Multiline list of format.
If filled, any group using a `format` matching one of the list will be excluded.

Note: "Forbidden" phase is performed **at the beginning of the process**, before everything else.
required: false
default: ''
forbidden-flags:
description: |
Multiline list of group name.
If filled, any group using at least one flag of the list will be excluded.

Note: "Forbidden" phase is performed **at the beginning of the process**, before everything else.
required: false
default: ''
forbidden-paths:
description: |
Multiline list of path. Basic path inclusion matching.
If filled, any group with a path matching one of the list will be excluded.

Note: "Forbidden" phase is performed **at the beginning of the process**, before everything else.
required: false
default: ''
allowed-groups:
description: |
Multiline list of group name.
If filled, only groups matching one of the list will be included.

Note: "Allowed" phase is performed **after "Forbidden" phase**.
required: false
default: ''
allowed-formats:
description: |
Multiline list of format.
If filled, only groups using a `format` matching one of the list will be included.

Note: "Allowed" phase is performed **after "Forbidden" phase**.
required: false
default: ''
allowed-flags:
description: |
Multiline list of group name.
If filled, only groups using at least one flag of the list will be included.

Note: "Allowed" phase is performed **after "Forbidden" phase**.
required: false
default: ''
allowed-paths:
description: |
Multiline list of path. Basic path inclusion matching.
If filled, only groups with a path mathcing one of the list will be included.

Note: "Allowed" phase is performed **after "Forbidden" phase**.
required: false
default: ''
# Artifact mode
artifacts-mode:
description: |
Each root directory of the provided `path` will be treated as artifact content. `path` must be a single valid path and not a glob pattern !
See `format` description for the metadata shape

Note: `artifacts-mode` is applied **after ""Filtering" phases** (`forbidden-*` and `allowed-*`)
required: false
default: 'false'
# Path-only mode
paths-only-mode:
description: |
Setting this to `true` will avoid subsequent operation (only filtering in & out has been performed and `artifacts-mode` enabled if needed) and just
build the list of path. Use this along with `path` input from reports-group/load-metadata-action in order to quickly merge multiple group into one.
required: false
default: 'false'
# "Grouping" phase
group-by:
description: |
Comma separated list of field used to group metadata list as a set of list.
Allowed values are:
- `name`: in order to produce a Set where all list contains groups with the same name
- `format`: in order to produce a Set where all list contains groups with the same format
- `flags`: in order to produce a Set where all list contains groups with the same **full set of flags**
- `artifact`: in order to produce a Set where all list contains groups from the same artifact
Using `flags,format` would produce the smallest set of reports groups to manage regardless of their name.
If you want to produce set of reports groups for each artifact

Note: "Grouping" phase is performed **after the "Filtering" phase** (`forbidden-*` and `allowed-*`) and after `artifacts-mode` may have been enabled
required: false
default: ''
# Matrix mode
matrix-mode:
description: |
Setting this to `true` will create an output named `matrix` (`list` output won't be filled !) containing a JSON matrix object.
Re-use it to create job matrix: `matrix: $\{{ fromJson(STEP_OUTPUTS.matrix) }}`

Note: `matrix-mode` is applied at the very end of the process, job context will be the shape attached to `format` description, based on all previous inputs configured
required: false
default: 'false'
follow-symbolic-links:
description: Indicates whether to follow symbolic links when resolving `path`
required: false
default: 'false'

outputs:
count:
description: Number of group discovered
paths:
description: Glob compatible list of all reports group directory path (=multiline list of paths)
artifacts:
description: |
Glob compatible list of artefact name, can be used as `pattern` with action/download-artifact-action
Only filled if `artifacts-mode` is enabled !
list:
description: Glob compatible list of reports group directory path (=multiline list of paths)
description: |
JSON list, each item being a JSON metadata shape (the result from the "Grouping phase")
Empty when `paths-only-mode` or `matrix-mode` is enabled !

Note: See `format` input to figure out the metatada shape based on your inputs
matrix:
description: |
Filled only with `matrix` format and if `paths-only-mode` is not enabled !
A JSON encoded object which can be re-used as Job matrix by using the following notation: `matrix: $\{{ fromJson(STEP_OUTPUTS.matrix) }}`

See `format` and `matrix-mode` description to figure out the metatada shape based on your inputs

runs:
using: 'node20'
Expand Down
10 changes: 5 additions & 5 deletions .github/actions/reports-group/find-action/dist/index.js

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading