Skip to content

Commit 2432b3b

Browse files
committed
chore(ci): clean up github actions workflow
1 parent faf8262 commit 2432b3b

File tree

4 files changed

+41
-100
lines changed

4 files changed

+41
-100
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 54 deletions
This file was deleted.

.github/workflows/auto-update.yml renamed to .github/workflows/mcp-server-info-bot.yml

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Scrape and Update Repo
1+
name: MCP Server Info Bot
22

33
permissions:
44
contents: write
@@ -12,20 +12,44 @@ on:
1212
jobs:
1313
scrape-and-update:
1414
runs-on: ubuntu-latest
15-
if: github.event.label.name == 'new-server' # Trigger only on 'new-server' label
15+
if: github.event.label.name == 'mcp-server-info-bot' # Trigger only on 'mcp-server-info-bot' label
1616
steps:
17-
- name: Check if user is authorized
18-
env:
19-
SENDER: ${{ github.event.sender.login }}
17+
- name: Check if user is a maintainer
18+
uses: actions/github-script@v6
19+
id: check-maintainer
20+
with:
21+
github-token: ${{ secrets.GITHUB_TOKEN }}
22+
script: |
23+
const sender = context.payload.sender.login;
24+
const { owner, repo } = context.repo;
25+
26+
try {
27+
// Check if user has write access (maintainer or higher)
28+
const { data: permission } = await github.rest.repos.getCollaboratorPermissionLevel({
29+
owner: owner,
30+
repo: repo,
31+
username: sender
32+
});
33+
34+
const hasWriteAccess = ['admin', 'maintain', 'write'].includes(permission.permission);
35+
36+
if (hasWriteAccess) {
37+
console.log(`✅ User ${sender} is a maintainer with ${permission.permission} permissions`);
38+
return true;
39+
} else {
40+
console.log(`❌ User ${sender} does not have sufficient permissions (${permission.permission})`);
41+
return false;
42+
}
43+
} catch (error) {
44+
console.log(`Error checking permissions: ${error.message}`);
45+
return false;
46+
}
47+
48+
- name: Fail if not maintainer
49+
if: steps.check-maintainer.outputs.result != 'true'
2050
run: |
21-
# Custom list of authorized users (GitHub usernames)
22-
AUTHORIZED_USERS="jeremy-dai-txyz JoJoJoJoJoJoJo niechen"
23-
if echo "$AUTHORIZED_USERS" | grep -q -w "$SENDER"; then
24-
echo "User $SENDER is authorized"
25-
else
26-
echo "User $SENDER is not authorized"
27-
exit 1
28-
fi
51+
echo "User ${{ github.event.sender.login }} does not have maintainer permissions"
52+
exit 1
2953
3054
- name: Checkout repository
3155
uses: actions/checkout@v4

.github/workflows/semver-check.yml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@ jobs:
3636

3737
- name: Check Release
3838
uses: cycjimmy/semantic-release-action@v4
39+
id: semantic
3940
with:
4041
dry_run: true
4142
ci: false
42-
unset_gha_env: true
4343
env:
4444
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4545

@@ -48,15 +48,11 @@ jobs:
4848
uses: actions/github-script@v7
4949
with:
5050
script: |
51-
const semanticResult = process.env.SEMANTIC_OUTPUT;
5251
let comment = '## Semantic Version Check\n\n';
5352
54-
if (semanticResult && semanticResult.includes('The next release version is')) {
55-
const versionMatch = semanticResult.match(/The next release version is (.*)/);
56-
if (versionMatch) {
57-
comment += `✅ Valid semantic version changes detected!\n\n`;
58-
comment += `Next version will be: **${versionMatch[1]}**\n`;
59-
}
53+
if ('${{ steps.semantic.outputs.new_release_version }}') {
54+
comment += `✅ Valid semantic version changes detected!\n\n`;
55+
comment += `Next version will be: **${{ steps.semantic.outputs.new_release_version }}**\n`;
6056
} else {
6157
comment += `⚠️ No semantic version changes detected.\n\n`;
6258
comment += 'Please ensure your commits follow the [Conventional Commits](https://www.conventionalcommits.org/) format:\n\n';

.github/workflows/validate-manifests.yml

Lines changed: 0 additions & 25 deletions
This file was deleted.

0 commit comments

Comments
 (0)