PATCH /repos/{owner}/{repo} writes repository metadata through the shared
store action path. The current demonstrator intentionally persists only
description and homepage; policy and visibility fields such as
visibility, merge strategy settings, and default_branch are accepted by the
request body but ignored until the repository settings roadmap slice implements
them.
import {type InitialState, simulation} from 'simulacat-core';
const initialState: InitialState = {
users: [],
organizations: [{login: 'acme'}],
repositories: [{owner: 'acme', name: 'awesome-repo', visibility: 'public'}],
branches: [{owner: 'acme', repo: 'awesome-repo', name: 'main'}],
blobs: []
};
const app = simulation({initialState});
const server = await app.listen(0);
const baseUrl = `http://127.0.0.1:${server.port}`;
try {
const response = await fetch(`${baseUrl}/repos/acme/awesome-repo`, {
method: 'PATCH',
headers: {
authorization: 'Bearer local-token',
'content-type': 'application/json'
},
body: JSON.stringify({
description: 'Patched via shared action',
homepage: 'https://docs.example.test',
visibility: 'private'
})
});
const repository = await response.json();
const persisted = await fetch(`${baseUrl}/repos/acme/awesome-repo`).then((result) => result.json());
const organizationRepositories = await fetch(`${baseUrl}/orgs/acme/repos`)
.then((result) => result.json());
const graphQlQuery = `query {
repository(owner: "acme", name: "awesome-repo") {
description
visibility
}
}`;
const graphQl = await fetch(`${baseUrl}/graphql`, {
method: 'POST',
headers: {'content-type': 'application/json'},
body: JSON.stringify({query: graphQlQuery})
}).then((result) => result.json());
console.log(JSON.stringify({repository, persisted, organizationRepositories, graphQl}));
} finally {
await server.ensureClose();
}
The persisted description is visible through GET /repos/{owner}/{repo},
GET /orgs/{org}/repos, and GraphQL repository(owner:, name:) reads. REST
responses also include the persisted homepage. The PATCH response is shaped
from the stored repository rather than the request body, so it matches those
subsequent reads. Repository write routes do not validate real GitHub tokens.