Skip to content

Commit 0969733

Browse files
Adding RsMetaCheck GitHub Action with Docker container and entrypoint script
1 parent e8d87a4 commit 0969733

4 files changed

Lines changed: 163 additions & 2 deletions

File tree

Dockerfile

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
FROM python:3.11-slim
2+
3+
# Install system dependencies
4+
RUN apt-get update && \
5+
apt-get install -y git && \
6+
rm -rf /var/lib/apt/lists/*
7+
8+
# Install the RsMetaCheck tool from PyPI
9+
RUN pip install --no-cache-dir rsmetacheck
10+
11+
# Copies the entrypoint script into the container
12+
COPY entrypoint.sh /entrypoint.sh
13+
RUN chmod +x /entrypoint.sh
14+
15+
# Code file to execute when the docker container starts up
16+
ENTRYPOINT ["/entrypoint.sh"]

README.md

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,47 @@
1-
# rs-metacheck-action
2-
Repository to maintain the research software metadata quality action
1+
# RsMetaCheck GitHub Action
2+
3+
A GitHub Action to detect metadata pitfalls in software repositories using SoMEF.
4+
This action wraps the [RsMetaCheck](https://pypi.org/project/rsmetacheck/) Python tool.
5+
6+
## Usage
7+
8+
Create a workflow file in your repository, for example `.github/workflows/rsmetacheck.yml`:
9+
10+
```yaml
11+
name: RsMetaCheck Validation
12+
13+
on:
14+
push:
15+
branches: ["main"]
16+
pull_request:
17+
branches: ["main"]
18+
19+
jobs:
20+
analyze-metadata:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout Code
24+
uses: actions/checkout@v4
25+
26+
- name: Run RsMetaCheck
27+
uses: your-github-username/rsmetacheck-action@v1
28+
with:
29+
# You can pass the repository URL automatically
30+
input: "https://github.com/${{ github.repository }}"
31+
pitfalls_output: "./pitfalls_outputs"
32+
verbose: "false"
33+
```
34+
35+
### Inputs
36+
37+
| Input | Description | Required | Default |
38+
| ------------------- | ---------------------------------------------------------------------- | -------- | ------------------------- |
39+
| `input` | One or more: GitHub/GitLab URLs, JSON files containing repositories. | **Yes** | |
40+
| `skip_somef` | Skip SoMEF execution and analyze existing SoMEF output files directly. | No | `false` |
41+
| `pitfalls_output` | Directory to store pitfall JSON-LD files. | No | `./pitfalls_outputs` |
42+
| `somef_output` | Directory to store SoMEF output files. | No | `./somef_outputs` |
43+
| `analysis_output` | File path for summary results. | No | `./analysis_results.json` |
44+
| `threshold` | SoMEF confidence threshold. Only used when running SoMEF. | No | `0.8` |
45+
| `branch` | Branch of the repository to analyze. | No | |
46+
| `generate_codemeta` | Generate codemeta files for each repository. | No | `false` |
47+
| `verbose` | Include both detected AND undetected pitfalls in the output JSON-LD. | No | `false` |

action.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: "RsMetaCheck"
2+
description: "Detect metadata pitfalls in software repositories using SoMEF."
3+
author: "goblin"
4+
branding:
5+
icon: "check-circle"
6+
color: "blue"
7+
8+
inputs:
9+
input:
10+
description: 'One or more: GitHub/GitLab URLs, JSON files containing repositories. (e.g. "https://github.com/owner/repo")'
11+
required: true
12+
skip_somef:
13+
description: "Skip SoMEF execution and analyze existing SoMEF output files directly."
14+
required: false
15+
default: "false"
16+
pitfalls_output:
17+
description: "Directory to store pitfall JSON-LD files."
18+
required: false
19+
default: "./pitfalls_outputs"
20+
somef_output:
21+
description: "Directory to store SoMEF output files."
22+
required: false
23+
default: "./somef_outputs"
24+
analysis_output:
25+
description: "File path for summary results."
26+
required: false
27+
default: "./analysis_results.json"
28+
threshold:
29+
description: "SoMEF confidence threshold. Only used when running SoMEF."
30+
required: false
31+
default: "0.8"
32+
branch:
33+
description: "Branch of the repository to analyze. Overrides the default branch. Only used when running SoMEF."
34+
required: false
35+
generate_codemeta:
36+
description: "Generate codemeta files for each repository. Only used when running SoMEF."
37+
required: false
38+
default: "false"
39+
verbose:
40+
description: "Include both detected AND undetected pitfalls in the output JSON-LD."
41+
required: false
42+
default: "false"
43+
44+
runs:
45+
using: "docker"
46+
image: "Dockerfile"

entrypoint.sh

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# Base command
5+
CMD="rsmetacheck"
6+
7+
# Handle required input
8+
if [ -n "$INPUT_INPUT" ]; then
9+
# Note: Do not quote $INPUT_INPUT here in case multiple URLs are passed as spaces
10+
CMD="$CMD --input $INPUT_INPUT"
11+
else
12+
echo "Error: The 'input' argument is required."
13+
exit 1
14+
fi
15+
16+
# Handle boolean flags
17+
if [ "$INPUT_SKIP_SOMEF" = "true" ]; then
18+
CMD="$CMD --skip-somef"
19+
fi
20+
21+
if [ "$INPUT_GENERATE_CODEMETA" = "true" ]; then
22+
CMD="$CMD --generate-codemeta"
23+
fi
24+
25+
if [ "$INPUT_VERBOSE" = "true" ]; then
26+
CMD="$CMD --verbose"
27+
fi
28+
29+
# Handle parameters with values
30+
if [ -n "$INPUT_PITFALLS_OUTPUT" ]; then
31+
CMD="$CMD --pitfalls-output \"$INPUT_PITFALLS_OUTPUT\""
32+
fi
33+
34+
if [ -n "$INPUT_SOMEF_OUTPUT" ]; then
35+
CMD="$CMD --somef-output \"$INPUT_SOMEF_OUTPUT\""
36+
fi
37+
38+
if [ -n "$INPUT_ANALYSIS_OUTPUT" ]; then
39+
CMD="$CMD --analysis-output \"$INPUT_ANALYSIS_OUTPUT\""
40+
fi
41+
42+
if [ -n "$INPUT_THRESHOLD" ]; then
43+
CMD="$CMD --threshold \"$INPUT_THRESHOLD\""
44+
fi
45+
46+
if [ -n "$INPUT_BRANCH" ]; then
47+
CMD="$CMD --branch \"$INPUT_BRANCH\""
48+
fi
49+
50+
echo "Executing RsMetaCheck command:"
51+
echo "$CMD"
52+
53+
# Evaluate the command so spaces inside quotes are respected properly
54+
eval "$CMD"

0 commit comments

Comments
 (0)