Skip to content

Commit d102ba9

Browse files
bthosbthosCopilot
authored
Enhance documentation and CI workflows for plugin validation (#14)
* Enhance documentation and CI workflows for plugin validation - Update CONTRIBUTING.md and README.md to clarify plugin submission steps and emphasize CI's role in validation and registry building. - Introduce new plugins: Billing, Goals, Pomodoro Timer, and Projects & Tasks, each with metadata and versioning. - Implement GitHub Actions workflows for automatic validation and registry updates upon PR merges. - Adjust validation scripts to improve error handling and streamline the validation process. Signed-off-by: bthos <bthos@example.com> Signed-off-by: bthos <el.mogul@outlook.es> * Update .github/workflows/validate-registry.yml Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update registry.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update registry.json Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * Update documentation for DCO requirements and validation commands - Clarify DCO sign-off requirements in CONTRIBUTING.md, emphasizing the need for a valid email address. - Rename validation command in package.json from `validate-all` to `validate-files` for better clarity. - Update README.md to reflect the new validation command and provide additional context on the validation process. - Modify the create plugin script output message to align with the updated validation command. Signed-off-by: bthos <el.mogul@outlook.com> Signed-off-by: bthos <el.mogul@outlook.es> * Update registry.json to reflect changes in last_updated timestamp, category for the billing plugin, and remove associated tags. Signed-off-by: bthos <el.mogul@outlook.es> --------- Signed-off-by: bthos <bthos@example.com> Signed-off-by: bthos <el.mogul@outlook.es> Signed-off-by: bthos <el.mogul@outlook.com> Co-authored-by: bthos <el.mogul@outlook.es> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 5894a36 commit d102ba9

File tree

11 files changed

+520
-220
lines changed

11 files changed

+520
-220
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Plugin Submission Checklist
22

33
- [ ] Plugin ID follows format: `author.plugin-name` or lowercase-with-hyphens
4-
- [ ] Manifest passes `npm run validate-plugins` (or `npm run validate-all`)
4+
- [ ] Plugin JSON is valid (CI will validate automatically)
55
- [ ] SHA256 checksum verified (if `distribution` with checksums is used)
66
- [ ] Plugin tested locally
77
- [ ] README / docs updated if adding new author or changing structure
@@ -26,3 +26,5 @@
2626
## DCO
2727

2828
By submitting this pull request, I certify that my contributions are made under the terms of the [Developer Certificate of Origin](https://developercertificate.org/). All commits are signed off with `git commit -s`.
29+
30+
**Note:** DCO requires a valid email address that matches your Git commit author email. See [CONTRIBUTING.md](../CONTRIBUTING.md#developer-certificate-of-origin-dco) for details.
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
name: Build Registry
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
paths:
8+
- 'plugins/**'
9+
- 'schemas/**'
10+
paths-ignore:
11+
- 'registry.json'
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
permissions:
17+
contents: write
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
22+
- name: Setup Node.js
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version: '18'
26+
27+
- name: Install dependencies
28+
run: |
29+
npm install
30+
31+
- name: Validate schema files
32+
run: |
33+
npm run validate-schemas
34+
35+
- name: Validate individual plugin files
36+
run: |
37+
npm run validate-plugins
38+
39+
- name: Build registry
40+
run: |
41+
npm run build
42+
43+
- name: Validate registry
44+
run: |
45+
npm run validate
46+
47+
- name: Validate repository URLs
48+
run: |
49+
node -e "
50+
const fs = require('fs');
51+
const registry = JSON.parse(fs.readFileSync('registry.json', 'utf8'));
52+
const https = require('https');
53+
const http = require('http');
54+
55+
async function checkUrl(url) {
56+
return new Promise((resolve) => {
57+
const client = url.startsWith('https') ? https : http;
58+
const req = client.get(url, { timeout: 5000 }, (res) => {
59+
resolve(res.statusCode === 200 || res.statusCode === 301 || res.statusCode === 302);
60+
});
61+
req.on('error', () => resolve(false));
62+
req.on('timeout', () => {
63+
req.destroy();
64+
resolve(false);
65+
});
66+
});
67+
}
68+
69+
(async () => {
70+
for (const plugin of registry.plugins) {
71+
if (plugin.repository) {
72+
const valid = await checkUrl(plugin.repository);
73+
if (!valid) {
74+
console.warn('Warning: Repository URL may be invalid:', plugin.repository);
75+
}
76+
}
77+
}
78+
console.log('Repository URL validation complete');
79+
})();
80+
"
81+
82+
- name: Commit registry.json
83+
run: |
84+
git config --local user.email "action@github.com"
85+
git config --local user.name "GitHub Action"
86+
git add registry.json
87+
if git diff --staged --quiet; then
88+
echo "No changes to registry.json"
89+
else
90+
git commit -m "chore: update registry.json [skip ci]"
91+
git push
92+
fi

.github/workflows/validate-manifest.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,6 @@ jobs:
3939
- name: Check for duplicates
4040
run: npm run check-duplicates
4141

42-
- name: Build registry
43-
run: npm run build
44-
45-
- name: Validate registry
46-
run: npm run validate
42+
- name: Validate registry (if exists)
43+
run: |
44+
npm run validate || echo "⚠️ registry.json not found, skipping validation"
Lines changed: 6 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
name: Validate Registry
22

33
on:
4-
push:
5-
branches:
6-
- main
7-
paths:
8-
- 'registry.json'
9-
- 'plugins/**'
10-
- 'schemas/**'
114
pull_request:
125
paths:
136
- 'registry.json'
@@ -38,45 +31,10 @@ jobs:
3831
run: |
3932
npm run validate-plugins
4033
41-
- name: Build registry
42-
run: |
43-
npm run build
44-
45-
- name: Validate registry
46-
run: |
47-
npm run validate
48-
49-
- name: Validate repository URLs
34+
- name: Validate registry (if exists)
5035
run: |
51-
node -e "
52-
const fs = require('fs');
53-
const registry = JSON.parse(fs.readFileSync('registry.json', 'utf8'));
54-
const https = require('https');
55-
const http = require('http');
56-
57-
async function checkUrl(url) {
58-
return new Promise((resolve) => {
59-
const client = url.startsWith('https') ? https : http;
60-
const req = client.get(url, { timeout: 5000 }, (res) => {
61-
resolve(res.statusCode === 200 || res.statusCode === 301 || res.statusCode === 302);
62-
});
63-
req.on('error', () => resolve(false));
64-
req.on('timeout', () => {
65-
req.destroy();
66-
resolve(false);
67-
});
68-
});
69-
}
70-
71-
(async () => {
72-
for (const plugin of registry.plugins) {
73-
if (plugin.repository) {
74-
const valid = await checkUrl(plugin.repository);
75-
if (!valid) {
76-
console.warn('Warning: Repository URL may be invalid:', plugin.repository);
77-
}
78-
}
79-
}
80-
console.log('Repository URL validation complete');
81-
})();
82-
"
36+
if [ -f registry.json ]; then
37+
npm run validate
38+
else
39+
echo "⚠️ registry.json not found, skipping validation"
40+
fi

0 commit comments

Comments
 (0)