forked from tarekwasfy01/Semantic-Programming-Language
-
Notifications
You must be signed in to change notification settings - Fork 0
87 lines (76 loc) · 2.62 KB
/
Copy pathregister-module.yml
File metadata and controls
87 lines (76 loc) · 2.62 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
name: Register Semantic module
on:
issues:
types: [opened]
permissions:
contents: write
issues: write
jobs:
register-module:
if: startsWith(github.event.issue.title, '[Module]:')
runs-on: ubuntu-latest
steps:
- name: Checkout website registry
uses: actions/checkout@v4
with:
ref: website
fetch-depth: 0
- name: Fetch registration script from main
run: |
git fetch origin main --depth=1
git show origin/main:scripts/register_module.py > /tmp/register_module.py
- name: Validate archive and update modules.json
env:
ISSUE_BODY: ${{ github.event.issue.body }}
REGISTRY_PATH: modules.json
run: python /tmp/register_module.py
- name: Commit registry update
run: |
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git add modules.json
if git diff --cached --quiet; then
echo "No registry change to commit."
else
git commit -m "Register Semantic module from issue #${{ github.event.issue.number }}"
git push origin HEAD:website
fi
- name: Confirm registration
if: success()
uses: actions/github-script@v7
with:
script: |
const body = [
"### Semantic Module Registry",
"",
"✓ Archive downloaded",
"✓ `.smod` manifest validated",
"✓ Registry updated",
"",
"Your module is now indexed.",
"",
"https://www.semantic-programming-language.com/modules.html"
].join("\n");
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body
});
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
state: "closed"
});
- name: Explain validation failure
if: failure()
uses: actions/github-script@v7
with:
script: |
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
body: "The module could not be registered. Open the failed Actions run to see the exact validation error."
});