Skip to content

Comments

Extract CI validation into reusable scripts#1

Merged
runkids merged 9 commits intomainfrom
extract-ci-scripts
Feb 12, 2026
Merged

Extract CI validation into reusable scripts#1
runkids merged 9 commits intomainfrom
extract-ci-scripts

Conversation

@runkids
Copy link
Owner

@runkids runkids commented Feb 12, 2026

Summary

  • Extract inline shell from validate-pr.yml into scripts/validate.sh and scripts/audit.sh
  • CI and local dev now run the same validation code
  • Add Makefile for convenient local testing
  • Add .gitignore to exclude .claude/

Local usage

make validate   # Validate skillshare-hub.json format and rules
make audit      # Audit new/changed skills against main
make ci         # Run both

Test plan

  • make validate passes locally
  • make audit passes locally (no diff against main)
  • make ci runs both targets successfully
  • Tested error detection: bad names, duplicates, invalid JSON all correctly caught
  • Workflow YAML syntax validated

Move inline shell from validate-pr.yml into scripts/validate.sh and
scripts/audit.sh so CI and local dev run the same code. Add Makefile
for convenient local testing (make validate / make audit / make ci).
Add scripts/** and the workflow file itself to the paths filter
so CI runs when validation logic is modified, not only when
skillshare-hub.json changes.
@gemini-code-assist
Copy link

Summary of Changes

Hello @runkids, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request refactors the CI validation process by extracting existing inline shell logic into reusable scripts. This change significantly improves the consistency between CI and local development environments, allowing developers to run the exact same validation and auditing checks locally. A new Makefile simplifies the execution of these checks, enhancing the overall developer experience.

Highlights

  • CI Logic Extraction: Extracted inline shell commands from validate-pr.yml into dedicated scripts/validate.sh and scripts/audit.sh for better modularity and reusability.
  • Unified Validation: Ensured that both CI pipelines and local development environments utilize the same validation and auditing logic, promoting consistency.
  • Local Development Enhancements: Introduced a Makefile to provide convenient commands (make validate, make audit, make ci) for local testing and validation.
  • Ignored Files: Added .claude/ to .gitignore to prevent temporary files from being committed.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • .gitignore
    • Added an entry to ignore the .claude/ directory.
  • Makefile
    • Added validate target to run scripts/validate.sh.
    • Added audit target to run scripts/audit.sh against the main branch.
    • Added ci target as a composite of validate and audit.
  • scripts/audit.sh
    • Created a new script to identify and audit new or changed skill sources from skillshare-hub.json against a base reference.
    • Included logic to clone repositories and run skillshare audit with a high threshold.
    • Implemented error handling and CI-friendly logging.
  • scripts/validate.sh
    • Created a new script to perform various validations on skillshare-hub.json.
    • Checks for valid JSON format, presence of required fields (name, description, source), absence of duplicate skill names, and correct skill name format.
Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/validate-pr.yml
Activity
  • No human activity has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

- Add scripts/format.sh: sort skills by name, normalize to jq 2-space
- Add format check to scripts/validate.sh (fails if unformatted)
- Add make format target
- Apply formatting to skillshare-hub.json
- Generate markdown report with source, status, and risk score
- Auto-post results as PR comment (replaces previous comment on re-run)
- Add permissions for pull-requests: write
- Fix grep -P incompatibility for macOS/Linux portability
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request extracts CI validation logic into reusable shell scripts, validate.sh and audit.sh, and adds a Makefile for local execution. However, it introduces GitHub Actions Command Injection vulnerabilities because untrusted data from the skillshare-hub.json file is printed to the console without proper sanitization. This could allow attackers to spoof CI results or manipulate workflow execution. It is recommended to validate all fields in skillshare-hub.json against strict regular expressions before use. Additionally, while the scripts are well-structured, there are suggestions to improve error message formatting in validate.sh and to use mktemp in audit.sh for robustness.


if [[ "$source" == http* ]]; then
clone_url="$source"
else

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

Using a predictable temporary directory name can lead to race conditions if multiple instances of this script run concurrently. It's safer to use mktemp -d to create a unique directory. For even more robust cleanup on script interruption, consider using a trap at the script level to remove the temporary directory on exit.

Suggested change
else
clone_dir=$(mktemp -d "/tmp/audit-${safe_name}.XXXXXX")

# Check required fields
missing=$(jq -r '.skills[] | select(.name == "" or .name == null or .description == "" or .description == null or .source == "" or .source == null) | .name // "unnamed"' "$HUB_FILE")
if [ -n "$missing" ]; then
echo "ERROR: Skills missing required fields: $missing"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The missing variable, which contains skill names from skillshare-hub.json, is printed directly to the console. This creates a GitHub Actions Command Injection vulnerability if a skill name contains a newline followed by a workflow command. It is crucial to validate the format of skill names before using them in any output. Additionally, for readability, if multiple skills are missing, they should be listed on separate lines.

# Check no duplicate names
dupes=$(jq -r '[.skills[].name] | group_by(.) | map(select(length > 1)) | flatten | .[]' "$HUB_FILE")
if [ -n "$dupes" ]; then
echo "ERROR: Duplicate skill names: $dupes"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The dupes variable, containing skill names from skillshare-hub.json, is printed directly to the console. This poses a GitHub Actions Command Injection vulnerability if a duplicate skill name includes a newline followed by a workflow command. It is critical to validate skill name formats before output. Additionally, for better readability, duplicate names should be listed on separate lines.

echo "No new or changed skill sources to audit"
[ -n "$REPORT_FILE" ] && echo "No new or changed skill sources to audit." > "$REPORT_FILE"
exit 0
fi

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

security-medium medium

The script prints the contents of the new_sources variable directly to the console. new_sources is derived from the source field in skillshare-hub.json, which is untrusted input from a pull request. If a malicious source contains a newline followed by a GitHub Actions workflow command (e.g., ::error::), the command will be executed by the GitHub Actions runner. This can be used to spoof CI results or manipulate the workflow.

Comment on lines +36 to +39
if [ -n "$bad_names" ]; then
echo "ERROR: Invalid skill names (must be lowercase, hyphens): $bad_names"
exit 1
fi

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

If there are multiple invalid skill names, they will be displayed on a single line, making the list difficult to parse. Displaying each invalid name on a new line would be more readable.

Suggested change
if [ -n "$bad_names" ]; then
echo "ERROR: Invalid skill names (must be lowercase, hyphens): $bad_names"
exit 1
fi
if [ -n "$bad_names" ]; then
echo "ERROR: Invalid skill names (must be lowercase, hyphens):"
echo "$bad_names"
exit 1
fi

- Switch skillshare install from gh release to curl install script
- Run skillshare init after install to create global config
- Treat "config not found" as audit failure instead of warning skip
- Add job summary step to display audit results in workflow page
hashFiles() only works within $GITHUB_WORKSPACE, so
/tmp/audit-report.md was never detected. Use step output
has_report flag to conditionally run comment and summary steps.
Add collapsible details section showing full skillshare audit
output (findings, severity, risk score) for each source.
Block only when aggregate Risk >= HIGH, not when individual
findings have high severity. LOW/MEDIUM risk skills now pass.
@github-actions
Copy link
Contributor

Skill Audit Results

Source Status Risk
anthropics/skills ✅ Passed N/A

All skills passed the security audit.

Audit Details

anthropics/skills

skillshare audit
Scanning path target
mode: global
path: /tmp/audit-anthropics-skills
✓ No issues found in audit-anthropics-skills (0.7s)
── Summary ──
  Threshold: HIGH
  Scanned:   1 skill(s)
  Passed:    1
  Warning:   0
  Failed:    0
  Severity:  c/h/m/l/i = 0/0/0/0/0
  Risk:      CLEAN (0/100)

@runkids runkids merged commit 84faf9c into main Feb 12, 2026
2 checks passed
@runkids runkids deleted the extract-ci-scripts branch February 12, 2026 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant