Skip to content

Commit 2e6dbcf

Browse files
authored
Merge pull request #1 from Hack23/copilot/setup-riksdagsmonitor-project
Setup riksdagsmonitor: 14-language Swedish Parliament intelligence platform with ISMS compliance
2 parents 061d36a + f9c8e5c commit 2e6dbcf

32 files changed

+17905
-156
lines changed

.github/copilot-mcp.json

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
{
2+
"$schema": "https://github.com/modelcontextprotocol/specification/blob/main/schema/mcp-config-schema.json",
3+
"mcpServers": {
4+
"filesystem": {
5+
"command": "npx",
6+
"args": ["-y", "@modelcontextprotocol/server-filesystem", "/workspaces/riksdagsmonitor"],
7+
"description": "Provides secure filesystem access for reading and editing project files",
8+
"disabled": false
9+
},
10+
"github": {
11+
"type": "local",
12+
"command": "npx",
13+
"args": [
14+
"-y",
15+
"@modelcontextprotocol/server-github",
16+
"--toolsets",
17+
"all"
18+
],
19+
"env": {
20+
"GITHUB_TOKEN": "${{ secrets.COPILOT_MCP_GITHUB_PERSONAL_ACCESS_TOKEN }}",
21+
"GITHUB_PERSONAL_ACCESS_TOKEN": "${{ secrets.COPILOT_MCP_GITHUB_PERSONAL_ACCESS_TOKEN }}",
22+
"GITHUB_OWNER": "Hack23"
23+
}
24+
},
25+
"sequential-thinking": {
26+
"command": "npx",
27+
"args": [
28+
"-y",
29+
"@modelcontextprotocol/server-sequential-thinking"
30+
]
31+
},
32+
"git": {
33+
"command": "npx",
34+
"args": ["-y", "@modelcontextprotocol/server-git", "--repository", "/workspaces/riksdagsmonitor"],
35+
"description": "Provides Git operations and repository history context",
36+
"disabled": false
37+
},
38+
"memory": {
39+
"command": "npx",
40+
"args": ["-y", "@modelcontextprotocol/server-memory"],
41+
"description": "Maintains conversation history and context between agent sessions",
42+
"disabled": false
43+
},
44+
"brave-search": {
45+
"command": "npx",
46+
"args": ["-y", "@modelcontextprotocol/server-brave-search"],
47+
"env": {
48+
"BRAVE_API_KEY": "${BRAVE_API_KEY}"
49+
},
50+
"description": "Enables searching documentation",
51+
"disabled": true,
52+
"note": "Enable this by setting BRAVE_API_KEY environment variable"
53+
},
54+
"playwright": {
55+
"command": "npx",
56+
"args": ["-y", "@modelcontextprotocol/server-playwright"],
57+
"description": "Browser automation for testing and debugging web applications",
58+
"disabled": false
59+
}
60+
},
61+
"globalShortcut": "Ctrl+Shift+Space"
62+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: "Copilot Setup Steps"
2+
3+
# Automatically run the setup steps when they are changed to allow for easy validation, and
4+
# allow manual testing through the repository's "Actions" tab
5+
on:
6+
workflow_dispatch:
7+
push:
8+
paths:
9+
- .github/workflows/copilot-setup-steps.yml
10+
pull_request:
11+
paths:
12+
- .github/workflows/copilot-setup-steps.yml
13+
14+
env:
15+
GITHUB_TOKEN: ${{ secrets.COPILOT_MCP_GITHUB_PERSONAL_ACCESS_TOKEN }}
16+
GITHUB_PERSONAL_ACCESS_TOKEN: ${{ secrets.COPILOT_MCP_GITHUB_PERSONAL_ACCESS_TOKEN }}
17+
18+
jobs:
19+
# The job MUST be called `copilot-setup-steps` or it will not be picked up by Copilot.
20+
copilot-setup-steps:
21+
runs-on: ubuntu-latest
22+
23+
# Set the permissions to the lowest permissions possible needed for your steps.
24+
# Copilot will be given its own token for its operations.
25+
permissions:
26+
contents: read
27+
actions: read
28+
attestations: read
29+
checks: read
30+
deployments: read
31+
issues: write
32+
models: read
33+
discussions: read
34+
pages: read
35+
pull-requests: write
36+
security-events: read
37+
statuses: read
38+
39+
# Steps run before the agent starts working
40+
steps:
41+
- name: Checkout
42+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Dependency Review Action
2+
#
3+
# This Action will scan dependency manifest files that change as part of a Pull Request,
4+
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
5+
# Once installed, if the workflow run is marked as required,
6+
# PRs introducing known-vulnerable packages will be blocked from merging.
7+
#
8+
# Source repository: https://github.com/actions/dependency-review-action
9+
name: 'Dependency Review'
10+
on: [pull_request]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
dependency-review:
17+
runs-on: ubuntu-latest
18+
steps:
19+
- name: Harden Runner
20+
uses: step-security/harden-runner@20cf305ff2073D973412fa9b1e3a4f227bda3c76 # v2.14.0
21+
with:
22+
egress-policy: audit # TODO: change to 'egress-policy: block' after couple of runs
23+
24+
- name: 'Checkout Repository'
25+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
26+
27+
- name: Cache apt packages
28+
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
29+
with:
30+
path: /var/cache/apt/archives
31+
key: ${{ runner.os }}-apt-${{ hashFiles('**/.github/workflows/dependency-review.yml') }}
32+
restore-keys: |
33+
${{ runner.os }}-apt-
34+
35+
- name: 'Dependency Review'
36+
uses: actions/dependency-review-action@3c4e3dcb1aa7874d2c16be7d79418e9b7efd6261 # v4.8.2
37+
with:
38+
comment-summary-in-pr: always
Lines changed: 210 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,210 @@
1+
name: Quality Checks
2+
3+
on:
4+
push:
5+
branches: [ master, main ]
6+
pull_request:
7+
branches: [ master, main ]
8+
9+
permissions:
10+
contents: read
11+
12+
jobs:
13+
html-validation:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Harden Runner
17+
uses: step-security/harden-runner@20cf305ff2073D973412fa9b1e3a4f227bda3c76 # v2.14.0
18+
with:
19+
egress-policy: audit
20+
21+
- name: Checkout repository
22+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
23+
24+
- name: Setup Node.js
25+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
26+
with:
27+
node-version: '24'
28+
29+
- name: Cache npm global packages
30+
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
31+
with:
32+
path: ~/.npm
33+
key: ${{ runner.os }}-npm-global-${{ hashFiles('**/package-lock.json') }}-htmlhint
34+
restore-keys: |
35+
${{ runner.os }}-npm-global-
36+
37+
- name: Install HTMLHint
38+
run: npm install -g htmlhint
39+
40+
- name: Validate HTML
41+
run: |
42+
echo "🔍 Validating HTML files with HTMLHint..."
43+
echo ""
44+
45+
# Run HTMLHint on all HTML files and capture results
46+
if htmlhint *.html > htmlhint-report.txt 2>&1; then
47+
echo "✅ All HTML files passed validation"
48+
cat htmlhint-report.txt
49+
else
50+
echo "⚠️ HTML validation found issues:"
51+
cat htmlhint-report.txt
52+
echo ""
53+
echo "📊 Validation completed with warnings/errors"
54+
# Don't fail the build on HTML validation issues initially
55+
# exit 1
56+
fi
57+
58+
- name: Upload HTMLHint Report
59+
if: always()
60+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
61+
with:
62+
name: htmlhint-report
63+
path: htmlhint-report.txt
64+
retention-days: 30
65+
66+
link-checker:
67+
runs-on: ubuntu-latest
68+
steps:
69+
- name: Harden Runner
70+
uses: step-security/harden-runner@20cf305ff2073D973412fa9b1e3a4f227bda3c76 # v2.14.0
71+
with:
72+
egress-policy: audit
73+
74+
- name: Checkout repository
75+
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
76+
77+
- name: Setup Node.js
78+
uses: actions/setup-node@6044e13b5dc448c55e2357c09f80417699197238 # v6.2.0
79+
with:
80+
node-version: '24'
81+
82+
- name: Cache npm packages
83+
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
84+
with:
85+
path: ~/.npm
86+
key: ${{ runner.os }}-npm-linkinator6-${{ hashFiles('**/package-lock.json') }}
87+
restore-keys: |
88+
${{ runner.os }}-npm-linkinator6-
89+
90+
- name: Cache apt packages
91+
uses: actions/cache@8b402f58fbc84540c8b491a91e594a4576fec3d7 # v5.0.2
92+
with:
93+
path: /var/cache/apt/archives
94+
key: ${{ runner.os }}-apt-${{ hashFiles('**/.github/workflows/quality-checks.yml') }}
95+
restore-keys: |
96+
${{ runner.os }}-apt-
97+
98+
- name: Install linkinator@6
99+
run: |
100+
echo "Installing linkinator v6 (v7.5.2 has module resolution bug)..."
101+
npm install -g linkinator@6
102+
linkinator --version
103+
echo "✅ linkinator v6 installed successfully"
104+
105+
- name: Install jq
106+
run: sudo apt-get update && sudo apt-get install -y jq
107+
108+
- name: Check internal links (static files)
109+
run: |
110+
echo "🔍 Starting local HTTP server for internal link checking..."
111+
python3 -m http.server 8080 &
112+
SERVER_PID=$!
113+
echo "Server PID: $SERVER_PID"
114+
115+
# Wait for server to start
116+
sleep 5
117+
118+
echo ""
119+
echo "🔗 Checking internal links on localhost..."
120+
121+
# Check links on localhost using global linkinator v6
122+
linkinator http://localhost:8080/ \
123+
--recurse \
124+
--skip "^(?!http://localhost:8080)" \
125+
--format json > internal-links-report.json || true
126+
127+
# Kill server
128+
kill $SERVER_PID 2>/dev/null || true
129+
130+
# Parse and display results
131+
echo ""
132+
echo "📊 Internal Link Check Results:"
133+
if [ -f internal-links-report.json ]; then
134+
jq '.links[0:10]' internal-links-report.json
135+
136+
# Count passed and failed links
137+
read passed failed < <(jq -r '
138+
[([.links[] | select(.state == "OK")] | length),
139+
([.links[] | select(.state != "OK")] | length)] | @tsv
140+
' internal-links-report.json 2>/dev/null || echo "0 0")
141+
142+
echo ""
143+
echo "✅ Passed: $passed links"
144+
echo "❌ Failed: $failed links"
145+
fi
146+
147+
- name: Check external links (sample pages)
148+
run: |
149+
echo ""
150+
echo "🌐 Checking external links on deployed site (sample check)..."
151+
echo "Note: Only checking main index page to avoid rate limiting"
152+
153+
# Check external links on deployed site
154+
linkinator https://riksdagsmonitor.com/ \
155+
--skip "(fonts\.googleapis\.com|fonts\.gstatic\.com|github\.com)" \
156+
--timeout 30000 \
157+
--format json > external-links-report.json || true
158+
159+
echo ""
160+
echo "📊 External Link Check Results:"
161+
if [ -f external-links-report.json ]; then
162+
jq '.links[0:10]' external-links-report.json
163+
164+
# Count passed and failed links
165+
read passed failed < <(jq -r '
166+
[([.links[] | select(.state == "OK")] | length),
167+
([.links[] | select(.state != "OK")] | length)] | @tsv
168+
' external-links-report.json 2>/dev/null || echo "0 0")
169+
170+
echo ""
171+
echo "✅ Passed: $passed links"
172+
echo "❌ Failed: $failed links"
173+
echo ""
174+
echo "ℹ️ Note: External link checking is limited to avoid rate limiting"
175+
fi
176+
177+
- name: Upload Link Check Reports
178+
if: always()
179+
uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
180+
with:
181+
name: link-checker-reports
182+
path: |
183+
internal-links-report.json
184+
external-links-report.json
185+
retention-days: 30
186+
187+
summary:
188+
runs-on: ubuntu-latest
189+
needs: [html-validation, link-checker]
190+
if: always()
191+
steps:
192+
- name: Harden the runner (Audit all outbound calls)
193+
uses: step-security/harden-runner@20cf305ff2073D973412fa9b1e3a4f227bda3c76 # v2.14.0
194+
with:
195+
egress-policy: audit
196+
197+
- name: Quality Check Summary
198+
run: |
199+
echo "=========================================="
200+
echo " Quality Checks Completed"
201+
echo "=========================================="
202+
echo ""
203+
echo "✅ HTML validation completed"
204+
echo "✅ Link checking completed"
205+
echo ""
206+
echo "📊 Check artifacts for detailed reports:"
207+
echo " - htmlhint-report"
208+
echo " - link-checker-reports"
209+
echo ""
210+
echo "=========================================="

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,11 @@
11
/.project
2+
.DS_Store
3+
*~
4+
*.bak
5+
*.swp
6+
.vscode/
7+
.idea/
8+
node_modules/
9+
dist/
10+
build/
11+
*.log

0 commit comments

Comments
 (0)