-
Notifications
You must be signed in to change notification settings - Fork 1
Add PR validation workflow and docs #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
FortiShield
wants to merge
5
commits into
CtxOS:main
Choose a base branch
from
FortiShield:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
05bec3f
feat: add ui, framework, monologue tags to TAGS.md
FortiShield 9686c06
Add validation script for plugin pull requests
FortiShield ff97c00
Implement comment validation failure handling script
FortiShield 1bb19ff
Create plugin.yaml
FortiShield 4b7147b
Create validate-plugin-pr.yml
FortiShield File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | ||
|
|
||
| - name: Fail job if validation failed | ||
| if: ${{ steps.validate.outputs.exit_code != '0' }} | ||
| run: exit 1 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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, | ||
| }); | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 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:
Repository: CtxOS/ctx-plugins
Length of output: 100
🏁 Script executed:
Repository: CtxOS/ctx-plugins
Length of output: 1002
Invalid input
script-fileforactions/github-script@v7.The
script-fileinput does not exist inactions/github-script@v7. The action only accepts ascriptinput. This will cause the workflow step to fail.To execute an external script file, read its content and pass it to the
scriptinput:🔧 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