Skip to content

Commit a4b6cdc

Browse files
liukatkatgithub-actions[bot]
authored andcommitted
[create-pull-request] automated change
1 parent b6429df commit a4b6cdc

7 files changed

Lines changed: 243 additions & 0 deletions

File tree

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Require Version Bump Label
2+
3+
on:
4+
pull_request:
5+
types: [opened, labeled, unlabeled, synchronize]
6+
7+
jobs:
8+
check-plugin-changes:
9+
name: Check for Plugin Changes
10+
runs-on: ubuntu-latest
11+
outputs:
12+
has_plugin_changes: ${{ steps.check.outputs.has_changes }}
13+
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
- name: Check if plugin files changed
19+
id: check
20+
run: |
21+
# Get list of changed files
22+
CHANGED_FILES=$(git diff --name-only origin/${{ github.base_ref }}...HEAD)
23+
24+
# Define plugin file patterns (adjust based on repo structure)
25+
# For Claude: plugin/, For Cursor: hooks/, mcp.json, skills/, scripts/
26+
PLUGIN_PATTERNS="plugin/|hooks/|mcp\.json|\.mcp\.json|skills/|scripts/|commands/|semgrep-version"
27+
28+
if echo "$CHANGED_FILES" | grep -qE "$PLUGIN_PATTERNS"; then
29+
echo "has_changes=true" >> $GITHUB_OUTPUT
30+
echo "Plugin files changed:"
31+
echo "$CHANGED_FILES" | grep -E "$PLUGIN_PATTERNS" || true
32+
else
33+
echo "has_changes=false" >> $GITHUB_OUTPUT
34+
echo "No plugin files changed"
35+
fi
36+
37+
check-version-label:
38+
name: Check Version Bump Label
39+
needs: check-plugin-changes
40+
if: needs.check-plugin-changes.outputs.has_plugin_changes == 'true'
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Check for version bump label
44+
run: |
45+
LABELS='${{ toJson(github.event.pull_request.labels.*.name) }}'
46+
47+
if echo "$LABELS" | grep -q '"bump:patch"'; then
48+
echo "✓ Found label: bump:patch"
49+
exit 0
50+
elif echo "$LABELS" | grep -q '"bump:minor"'; then
51+
echo "✓ Found label: bump:minor"
52+
exit 0
53+
elif echo "$LABELS" | grep -q '"bump:major"'; then
54+
echo "✓ Found label: bump:major"
55+
exit 0
56+
else
57+
echo "✗ Missing version bump label!"
58+
echo ""
59+
echo "This PR modifies plugin files and requires a version bump."
60+
echo "Please add one of the following labels:"
61+
echo " - bump:patch (bug fixes: 0.4.1 → 0.4.2)"
62+
echo " - bump:minor (new features: 0.4.1 → 0.5.0)"
63+
echo " - bump:major (breaking changes: 0.4.1 → 1.0.0)"
64+
exit 1
65+
fi

.github/workflows/version-bump.yml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Version Bump on Label
2+
3+
on:
4+
pull_request:
5+
types: [labeled]
6+
7+
jobs:
8+
bump-version:
9+
name: Bump Version
10+
if: startsWith(github.event.label.name, 'bump:')
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
with:
15+
token: ${{ secrets.GITHUB_TOKEN }}
16+
ref: ${{ github.head_ref }}
17+
18+
- name: Determine bump type
19+
id: bump_type
20+
run: |
21+
LABEL="${{ github.event.label.name }}"
22+
BUMP_TYPE="${LABEL#bump:}"
23+
echo "type=$BUMP_TYPE" >> $GITHUB_OUTPUT
24+
25+
- name: Find plugin.json
26+
id: find_plugin
27+
run: |
28+
# Look for plugin.json in different locations
29+
if [ -f "plugin/.claude-plugin/plugin.json" ]; then
30+
echo "path=plugin/.claude-plugin/plugin.json" >> $GITHUB_OUTPUT
31+
elif [ -f ".claude-plugin/plugin.json" ]; then
32+
echo "path=.claude-plugin/plugin.json" >> $GITHUB_OUTPUT
33+
elif [ -f ".cursor-plugin/plugin.json" ]; then
34+
echo "path=.cursor-plugin/plugin.json" >> $GITHUB_OUTPUT
35+
else
36+
echo "Could not find plugin.json"
37+
exit 1
38+
fi
39+
40+
- name: Read current version
41+
id: current_version
42+
run: |
43+
PLUGIN_JSON="${{ steps.find_plugin.outputs.path }}"
44+
VERSION=$(grep -o '"version": *"[^"]*"' "$PLUGIN_JSON" | head -1 | grep -o '[0-9]*\.[0-9]*\.[0-9]*')
45+
echo "version=$VERSION" >> $GITHUB_OUTPUT
46+
echo "Current version: $VERSION"
47+
48+
- name: Calculate new version
49+
id: new_version
50+
run: |
51+
VERSION="${{ steps.current_version.outputs.version }}"
52+
BUMP_TYPE="${{ steps.bump_type.outputs.type }}"
53+
54+
IFS='.' read -r MAJOR MINOR PATCH <<< "$VERSION"
55+
56+
case "$BUMP_TYPE" in
57+
major)
58+
MAJOR=$((MAJOR + 1))
59+
MINOR=0
60+
PATCH=0
61+
;;
62+
minor)
63+
MINOR=$((MINOR + 1))
64+
PATCH=0
65+
;;
66+
patch)
67+
PATCH=$((PATCH + 1))
68+
;;
69+
esac
70+
71+
NEW_VERSION="$MAJOR.$MINOR.$PATCH"
72+
echo "version=$NEW_VERSION" >> $GITHUB_OUTPUT
73+
echo "Bumping version: $VERSION → $NEW_VERSION ($BUMP_TYPE)"
74+
75+
- name: Update version in plugin.json
76+
run: |
77+
PLUGIN_JSON="${{ steps.find_plugin.outputs.path }}"
78+
OLD_VERSION="${{ steps.current_version.outputs.version }}"
79+
NEW_VERSION="${{ steps.new_version.outputs.version }}"
80+
81+
sed -i "s/\"version\": *\"$OLD_VERSION\"/\"version\": \"$NEW_VERSION\"/" "$PLUGIN_JSON"
82+
83+
echo "Updated $PLUGIN_JSON:"
84+
grep version "$PLUGIN_JSON"
85+
86+
- name: Commit version bump
87+
run: |
88+
git config --local user.email "github-actions[bot]@users.noreply.github.com"
89+
git config --local user.name "github-actions[bot]"
90+
git add .
91+
git commit -m "chore: bump version to ${{ steps.new_version.outputs.version }}"
92+
git push

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Semgrep MCP Marketplace
2+
3+
This repo is where the Semgrep Cursor Plugin lives.
4+
5+
To use the Semgrep plugin:
6+
1. Install the plugin from the Cursor Plugin Marketplace
7+
8+
1. Run the `/semgrep-plugin:setup_semgrep_plugin` command.
9+
10+
## Contributing
11+
12+
This plugin is managed by the [mcp-marketplace-template](https://github.com/semgrep/mcp-marketplace-template) repository. Changes should be made there and synced via automated PRs.

hooks/hooks.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"version": 1,
3+
"hooks": {
4+
"afterFileEdit": [
5+
{
6+
"command": "semgrep mcp -k record-file-edit -a cursor"
7+
}
8+
],
9+
"stop": [
10+
{
11+
"command": "semgrep mcp -k stop-cli-scan -a cursor"
12+
}
13+
]
14+
}
15+
}

mcp.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
{
2+
"mcpServers": {
3+
"semgrep": {
4+
"command": "semgrep",
5+
"args": [
6+
"mcp"
7+
]
8+
}
9+
}
10+
}

semgrep-version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.146.0

skills/setup_semgrep_plugin.md

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Setup Semgrep Plugin
2+
3+
Follow these steps to set up the Semgrep plugin:
4+
5+
## 1. Install Semgrep
6+
7+
Check if Semgrep is installed, and install it if not:
8+
9+
```bash
10+
which semgrep || brew install semgrep
11+
```
12+
13+
## 2. Authenticate with Semgrep
14+
15+
Log in to Semgrep (this will open a browser window):
16+
17+
```bash
18+
semgrep login --force
19+
```
20+
21+
## 3. Install Semgrep Pro Engine
22+
23+
Install the Pro engine for enhanced scanning capabilities:
24+
25+
```bash
26+
semgrep install-semgrep-pro || true
27+
```
28+
29+
## 4. Verify Installation
30+
31+
Confirm everything is working:
32+
33+
```bash
34+
semgrep --pro --version
35+
```
36+
37+
## 5. Check Version Compatibility
38+
39+
Verify your Semgrep version is >= 1.146.0:
40+
41+
```bash
42+
semgrep --version
43+
```
44+
45+
If your version is older than 1.146.0, please update:
46+
```bash
47+
brew upgrade semgrep
48+
```

0 commit comments

Comments
 (0)