update-subject-idmap/README.md

57 lines
2.1 KiB
Markdown

# Forgejo Action for generating (partial) subject ID mappings
Generates a filtered subject ID mapping from a broker's `id.tsv` and publishes
it to a destination repository.
## Parameters
The following optional parameters can be given via the `with` key. Example:
```yaml
- name: Update ID mapping
uses: https://hub.trr379.de/actions/update-subject-idmap@v1
with:
jwt-audience: u:1:<authorized-integration>
destination-repo: q01-<site>/<source>
destination-file: idmap.tsv
columns: trr-sub,...
miller-filter: '$diagnostics-case-id =~ "^36-[0-9]+$"'
```
| Name | Default | Description |
|---|---|---|
| `jwt-audience` | — | Audience for the Forgejo JWT used to access the destination repository. |
| `destination-repo` | — | Repository to which the generated ID mapping is published. |
| `destination-file` | — | Name of the generated mapping file in the destination repository. |
| `columns` | — | Comma-separated list of columns to extract from `id.tsv`. |
| `miller-filter` | - | Optional filter containing a Miller DSL expression (see row filters) |
### Input row filtering
Use the optional `miller-filter` parameter to exclude rows before the selected columns are written to the destination file.
The value is a [Miller DSL expression](https://miller.readthedocs.io/en/latest/reference-dsl).
Fields are referenced with a `$` prefix.
Use `==` to compare to literal values.
Regular expressions can be matched with the `=~` operator.
The filter is applied before the `columns` selection, so it can refer to any column in the source `id.tsv` file, including columns that are not included in the output.
This example keeps only rows where `diagnostics-case-id` consists of `36-` followed by one or more digits.
```yaml
miller-filter: '$diagnostics-case-id =~ "^36-[0-9]+$"'
```
`AND` conditions can be declared by concatenating them with `&&`.
Use `||` to accept either of multiple patterns.
Additional examples:
```yaml
miller-filter: '$trr-sub =~ "^[A-Z][0-9]+$" && $diagnostics-case-id =~ "^36-[0-9]+$"'
miller-filter: '$status =~ "^active$" || $status =~ "^pending$"'
miller-filter: '$site == "aachen" && $include == "true"'
```
## License
MIT