Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
2bb4cd1
security: require CodeQL governance check
vitormattos Sep 20, 2026
4d40467
fix: run governance action without runtime installs
vitormattos Sep 20, 2026
3cefa94
fix: run governance action without runtime installs
vitormattos Sep 20, 2026
69b77d3
refactor: use source TypeScript imports at runtime
vitormattos Sep 20, 2026
42ff105
refactor: use source TypeScript imports at runtime
vitormattos Sep 20, 2026
4c648a1
refactor: use source TypeScript imports at runtime
vitormattos Sep 20, 2026
1679c8a
refactor: use source TypeScript imports at runtime
vitormattos Sep 20, 2026
6082df6
refactor: use source TypeScript imports at runtime
vitormattos Sep 20, 2026
1b98af1
refactor: use source TypeScript imports at runtime
vitormattos Sep 20, 2026
77d3938
refactor: use source TypeScript imports at runtime
vitormattos Sep 20, 2026
de39ff9
refactor: use source TypeScript imports at runtime
vitormattos Sep 20, 2026
29c6ded
build: rewrite TypeScript import extensions
vitormattos Sep 20, 2026
bb46172
security: define governance code owners
vitormattos Sep 20, 2026
a6162cd
test: verify dependency-free action runtime
vitormattos Sep 20, 2026
b7ef94f
fix: complete native TypeScript imports
vitormattos Sep 20, 2026
5fb558b
fix: complete native TypeScript imports
vitormattos Sep 20, 2026
7dbe686
test: expose native runtime smoke diagnostics
vitormattos Sep 20, 2026
bf87919
chore: keep repository-local governance fixture unchanged
vitormattos Sep 20, 2026
636c8ef
refactor: use erasable TypeScript constructor fields
vitormattos Sep 20, 2026
9090020
test: keep native runtime smoke check concise
vitormattos Sep 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
# SPDX-License-Identifier: AGPL-3.0-or-later

.github/workflows/** @vitormattos
.github/dependabot.yml @vitormattos
governance.config.json @vitormattos
action.yml @vitormattos
discover/action.yml @vitormattos
SECURITY.md @vitormattos
docs/** @vitormattos
17 changes: 17 additions & 0 deletions .github/workflows/typescript.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,23 @@ jobs:
node-version: 24
package-manager-cache: false

- name: Verify native TypeScript action runtime
shell: bash
run: |
set +e
output="$(node src/cli.ts 2>&1)"
status=$?
set -e
test "$status" -eq 2
grep -F "Specify exactly one of --org OWNER or --repo OWNER/REPO" <<< "$output"

set +e
output="$(node src/discover-repositories.ts 2>&1)"
status=$?
set -e
test "$status" -eq 2
grep -F "Usage: discover-repositories ORGANIZATION" <<< "$output"

- name: Install dependencies
run: npm install --ignore-scripts

Expand Down
11 changes: 1 addition & 10 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,15 +28,6 @@ runs:
node-version: 24
package-manager-cache: false

- name: Install governance dependencies
shell: bash
working-directory: ${{ github.action_path }}
run: npm install --ignore-scripts

- name: Build governance CLI
shell: bash
working-directory: ${{ github.action_path }}
run: npm run build

- name: Reconcile rulesets
shell: bash
Expand All @@ -56,4 +47,4 @@ runs:
args+=(--apply)
fi

node dist/cli.js "${args[@]}"
node src/cli.ts "${args[@]}"
11 changes: 1 addition & 10 deletions discover/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,6 @@ runs:
node-version: 24
package-manager-cache: false

- name: Install governance dependencies
shell: bash
working-directory: ${{ github.action_path }}/..
run: npm install --ignore-scripts

- name: Build governance CLI
shell: bash
working-directory: ${{ github.action_path }}/..
run: npm run build

- name: Discover repositories
id: discover
Expand All @@ -44,5 +35,5 @@ runs:
ORGANIZATION: ${{ inputs.organization }}
working-directory: ${{ github.action_path }}/..
run: |
repositories="$(node dist/discover-repositories.js "$ORGANIZATION")"
repositories="$(node src/discover-repositories.ts "$ORGANIZATION")"
echo "repositories=$repositories" >> "$GITHUB_OUTPUT"
6 changes: 3 additions & 3 deletions src/cli-runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import {
loadGovernanceConfig,
resolveRepositoryRulesets,
type GovernanceConfig,
} from './config.js';
import type { GovernanceClient } from './governance.js';
} from './config.ts';
import type { GovernanceClient } from './governance.ts';
import {
planOrganization,
planRepository,
syncOrganization,
syncRepository,
} from './governance.js';
} from './governance.ts';

export type CliEnvironment = {
GITHUB_TOKEN?: string | undefined;
Expand Down
4 changes: 2 additions & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
// SPDX-License-Identifier: AGPL-3.0-or-later

import { runCli } from './cli-runner.js';
import { GitHubClient } from './github-client.js';
import { runCli } from './cli-runner.ts';
import { GitHubClient } from './github-client.ts';

const code = await runCli(
process.argv.slice(2),
Expand Down
4 changes: 2 additions & 2 deletions src/config-validation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import type {
BypassActor,
RepositoryRuleset,
RulesetRule,
} from './types.js';
} from './types.ts';
import type {
ConditionalGovernanceConfig,
GovernanceConfig,
RepositoryGovernanceConfig,
} from './config.js';
} from './config.ts';

export function validateGovernanceConfig(value: unknown): GovernanceConfig {
const root = expectRecord(value, '$');
Expand Down
6 changes: 3 additions & 3 deletions src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { readFile } from 'node:fs/promises';
import type {
BypassActor,
RepositoryRuleset,
} from './types.js';
} from './types.ts';
import type {
GitHubContentProbe,
RepositoryMetadata,
} from './repository-classifier.js';
import { validateGovernanceConfig } from './config-validation.js';
} from './repository-classifier.ts';
import { validateGovernanceConfig } from './config-validation.ts';

export type RepositoryGovernanceConfig = {
policies?: string[];
Expand Down
2 changes: 1 addition & 1 deletion src/discover-repositories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
// SPDX-License-Identifier: AGPL-3.0-or-later

import { discoverPublicRepositories } from './repository-discovery.js';
import { discoverPublicRepositories } from './repository-discovery.ts';

const organization = process.argv[2];

Expand Down
22 changes: 15 additions & 7 deletions src/github-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
import type {
RepositoryMetadata,
GitHubContentProbe,
} from './repository-classifier.js';
} from './repository-classifier.ts';
import type {
ExistingRepositoryRuleset,
RepositoryRulesetClient,
} from './ruleset-reconciler.js';
} from './ruleset-reconciler.ts';
import type {
BypassActor,
RepositoryRuleset,
RulesetRule,
} from './types.js';
} from './types.ts';

type FetchLike = typeof fetch;

Expand All @@ -34,11 +34,19 @@ type RulesetSummary = {
export class GitHubClient
implements GitHubContentProbe, RepositoryRulesetClient
{
private readonly token: string;
private readonly fetchImpl: FetchLike;
private readonly apiUrl: string;

constructor(
private readonly token: string,
private readonly fetchImpl: FetchLike = fetch,
private readonly apiUrl = 'https://api.github.com',
) {}
token: string,
fetchImpl: FetchLike = fetch,
apiUrl = 'https://api.github.com',
) {
this.token = token;
this.fetchImpl = fetchImpl;
this.apiUrl = apiUrl;
}

async getRepository(
owner: string,
Expand Down
6 changes: 3 additions & 3 deletions src/governance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import {
reconcileRepositoryRulesets,
type RepositoryRulesetClient,
type RulesetChange,
} from './ruleset-reconciler.js';
} from './ruleset-reconciler.ts';
import type {
GitHubContentProbe,
RepositoryMetadata,
} from './repository-classifier.js';
import type { RepositoryRuleset } from './types.js';
} from './repository-classifier.ts';
import type { RepositoryRuleset } from './types.ts';

export interface GovernanceClient
extends GitHubContentProbe,
Expand Down
2 changes: 1 addition & 1 deletion src/ruleset-normalizer.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
// SPDX-License-Identifier: AGPL-3.0-or-later

import type { RepositoryRuleset, RulesetRule } from './types.js';
import type { RepositoryRuleset, RulesetRule } from './types.ts';

function normalizeRule(rule: RulesetRule): RulesetRule {
if (rule.type === 'pull_request') {
Expand Down
4 changes: 2 additions & 2 deletions src/ruleset-reconciler.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
// SPDX-License-Identifier: AGPL-3.0-or-later

import type { RepositoryRuleset } from './types.js';
import { rulesetsEqual } from './ruleset-normalizer.js';
import type { RepositoryRuleset } from './types.ts';
import { rulesetsEqual } from './ruleset-normalizer.ts';

export type ExistingRepositoryRuleset = RepositoryRuleset & {
id: number;
Expand Down
2 changes: 1 addition & 1 deletion src/validate-release.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import { execFileSync } from 'node:child_process';
import { readFile } from 'node:fs/promises';
import { validateRelease } from './release-validator.js';
import { validateRelease } from './release-validator.ts';

const requestedVersion = process.argv[2];

Expand Down
3 changes: 2 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"skipLibCheck": true,
"types": [
"node"
]
],
"rewriteRelativeImportExtensions": true
},
"include": [
"src/**/*.ts",
Expand Down
Loading