Skip to content
Open
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
51 changes: 51 additions & 0 deletions .github/workflows/validate-plugin-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Validate Plugin PR

on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review]

permissions:
contents: read
pull-requests: write

jobs:
validate:
runs-on: ubuntu-latest
if: ${{ !github.event.pull_request.draft }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install pyyaml pillow

- name: Validate PR contents
id: validate
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
continue-on-error: true
run: |
set -o pipefail
python scripts/validate_pr.py 2>&1 | tee validation.log
echo "exit_code=${PIPESTATUS[0]}" >> "$GITHUB_OUTPUT"

- name: Comment on PR (validation failure)
if: ${{ steps.validate.outputs.exit_code != '0' }}
uses: actions/github-script@v7
with:
script-file: scripts/comment_validation_failure.js
Comment on lines +43 to +47
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

🌐 Web query:

What inputs does actions/github-script@v7 GitHub Action accept?

💡 Result:

The actions/github-script@v7 GitHub Action accepts the following inputs: - script: The body of an asynchronous JavaScript function to execute (required). - github-token: GitHub token for authentication (optional; defaults to GITHUB_TOKEN). - result-encoding: Encoding for the result output (string, json; default string). - retries: Number of retries for the script (default 0). - debug: Enable debug logging (boolean). - user-agent: Custom user agent prefix. - previews: API preview headers (now GraphQL only in v7). These are used in examples throughout the documentation, such as: with: script: | ... result-encoding: string retries: 3 Note that custom inputs like 'foo' are not valid and will cause warnings; use env vars for additional data passed to the script via process.env to avoid injection risks.

Citations:


🏁 Script executed:

# Check if the script file exists
find . -name "comment_validation_failure.js" -type f

# Check for any other uses of script-file in GitHub workflows
rg "script-file" --type yaml

Repository: CtxOS/ctx-plugins

Length of output: 100


🏁 Script executed:

head -50 ./scripts/comment_validation_failure.js

Repository: CtxOS/ctx-plugins

Length of output: 1002


Invalid input script-file for actions/github-script@v7.

The script-file input does not exist in actions/github-script@v7. The action only accepts a script input. This will cause the workflow step to fail.

To execute an external script file, read its content and pass it to the script input:

🔧 Proposed fix
     - name: Comment on PR (validation failure)
       if: ${{ steps.validate.outputs.exit_code != '0' }}
       uses: actions/github-script@v7
       with:
-        script-file: scripts/comment_validation_failure.js
+        script: |
+          const fs = require('fs');
+          const scriptContent = fs.readFileSync('./scripts/comment_validation_failure.js', 'utf8');
+          eval(scriptContent);

Or alternatively, move the script logic inline or use a module export approach if preferred.

🧰 Tools
🪛 actionlint (1.7.11)

[error] 45-45: missing input "script" which is required by action "actions/github-script@v7". all required inputs are "script"

(action)


[error] 47-47: input "script-file" is not defined in action "actions/github-script@v7". available inputs are "base-url", "debug", "github-token", "previews", "result-encoding", "retries", "retry-exempt-status-codes", "script", "user-agent"

(action)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/validate-plugin-pr.yml around lines 43 - 47, The workflow
uses the non-existent input script-file on actions/github-script@v7; replace
that usage by reading the external script and passing its contents to the script
input. Concretely, remove the script-file: scripts/comment_validation_failure.js
entry and instead load the file content (e.g., with a prior step that reads
scripts/comment_validation_failure.js into an output) then set script: to that
content for the actions/github-script@v7 step (or alternatively inline the JS
into the script: block); refer to the inputs named script and script-file and
the action tag actions/github-script@v7 when making the change.


- name: Fail job if validation failed
if: ${{ steps.validate.outputs.exit_code != '0' }}
run: exit 1
89 changes: 89 additions & 0 deletions TAGS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# Recommended tags

Use short, lowercase tags. Prefer existing tags from this list. Recommended: up to 5 tags.

## Core capabilities

- `memory`
- `storage`
- `files`
- `tools`
- `workflow`
- `automation`
- `jobs`
- `scheduling`

## AI / LLM

- `llm`
- `prompting`
- `embeddings`
- `rag`
- `agents`
- `monologue`

## Search / Retrieval

- `search`
- `web-search`
- `browser`
- `scraping`
- `documents`

## Web / APIs

- `api`
- `http`
- `web`
- `webhooks`
- `oauth`
- `ui`

## Data / Databases

- `database`
- `sql`
- `sqlite`
- `postgres`
- `redis`
- `vector-db`

## Integrations

- `integration`
- `github`
- `google`
- `notion`
- `jira`

## Communication

- `email`
- `slack`
- `discord`
- `telegram`

## Security

- `security`
- `auth`
- `secrets`

## Dev / Ops

- `development`
- `cli`
- `monitoring`
- `docker`
- `framework`

## Media

- `image`
- `audio`
- `video`

## Others

- `example`
- `template`
6 changes: 6 additions & 0 deletions plugins/_example1/plugin.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
title: Example Plugin
description: Example plugin template to demonstrate the plugin system
github: https://github.com/ctxos/ctx-plugin-example
tags:
- example
- template
37 changes: 37 additions & 0 deletions scripts/comment_validation_failure.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
const fs = require('fs');

const marker = '<!-- ctx-plugins-validation -->';
const raw = fs.readFileSync('validation.log', 'utf8');
const max = 60000;
const text = raw.length > max ? raw.slice(0, max) + '\n... (truncated)\n' : raw;
const body = `${marker}\n## Plugin submission validation failed\n\n\`\`\`\n${text}\n\`\`\`\n\nPush an update to this PR to re-run validation.`;

const { owner, repo } = context.repo;
const issue_number = context.payload.pull_request.number;

const comments = await github.paginate(github.rest.issues.listComments, {
owner,
repo,
issue_number,
per_page: 100,
});

const existing = comments.find(
(c) => (c.user?.type === 'Bot') && (c.body || '').includes(marker)
);

if (existing) {
await github.rest.issues.updateComment({
owner,
repo,
comment_id: existing.id,
body,
});
} else {
await github.rest.issues.createComment({
owner,
repo,
issue_number,
body,
});
}
Loading