Skip to content
Connect an agent

Organisations

Turn on diagrams in a repository with one pull request

Carries out the plan detect shows: a fresh setup or only the additions to the repository's own setup in one pull request on plotwork/setup, no pull request for a setup that covers everything, nothing for a settings file that does not check; and a trusted publisher for the workflow file the repository uses.

POST/orgs/{org}/github/repositories/{id}/enable

TL;DR

QuestionAnswer
What does it do?Turn on diagrams in a repository with one pull request.
What does it take?org, id in the path.
What does it return?Status 200 with a body of type GithubEnable.
What can go wrong?401 not signed in; 403 a member may not (orgs.forbidden), the plan has no GitHub App (plan.github_app_not_included), or the request came from an origin that may not make changes; 404 no such organisation or repository (github.repository_not_found); 409 the installation is suspended (github.suspended); 422 nothing in the repository could be drawn (github.nothing_to_draw), or its settings file does not check (github.config_invalid, with the problems in details); 429 too many requests, or GitHub asked to wait (github.rate_limited, with Retry-After); 502 GitHub could not be reached (github.unavailable); 503 the GitHub App is not set up on this server (github.not_configured), or organisations are not. Or the drawing engine is not available (engine.unavailable). Every failure uses the one error envelope.

What it does

Carries out the plan detect shows: a fresh setup or only the additions to the repository's own setup in one pull request on plotwork/setup, no pull request for a setup that covers everything, nothing for a settings file that does not check; and a trusted publisher for the workflow file the repository uses. Files are never stored. The owner and an admin, on Pro and Enterprise.

Path parameters

FieldTypeRequiredDescription
orgstringyesThe organisation's id or its slug.
idstringyesGitHub's id.

Responses

StatusMeaningBody
200The pull request, opened now or open already.GithubEnable
401Not signed in.ErrorResponse
403A member may not (orgs.forbidden), the plan has no GitHub App (plan.github_app_not_included), or the request came from an origin that may not make changes.ErrorResponse
404No such organisation or repository (github.repository_not_found).ErrorResponse
409The installation is suspended (github.suspended).ErrorResponse
422Nothing in the repository could be drawn (github.nothing_to_draw), or its settings file does not check (github.config_invalid, with the problems in details).ErrorResponse
429Too many requests, or GitHub asked to wait (github.rate_limited, with Retry-After).ErrorResponse
502GitHub could not be reached (github.unavailable).ErrorResponse
503The GitHub App is not set up on this server (github.not_configured), or organisations are not. Or the drawing engine is not available (engine.unavailable).ErrorResponse

Response body

A 200 answer has the type GithubEnable.

FieldTypeRequiredDescription
repositoryGithubRepositoryyes
repository.idstringyesGitHub's repository id.
repository.installationIdstringyes
repository.fullNamestringyes
repository.privatebooleanyes
repository.defaultBranchstringyes
repository.formatsarray | nullyesThe import formats the last scan found, such as terraform; null before a scan and after a push to the default branch.
repository.detectedAtinteger | nullyes
repository.status"none" | "pr_open" | "fix_open" | "merged" | "closed" | "adopted" | "reporting" | "failing"yesnone: not enabled. pr_open: the setup pull request is open. fix_open: a pull request that fixes the settings file is open; once it closes, the repository is scanned again. merged: merged, no drift run since. adopted: set up already, so Enable registered CI with no pull request, and no drift run since. reporting or failing: the latest drift run since it was enabled was clean, or drifted or failed. closed: the pull request was closed without merging.
repository.pullRequestobject | nullyes
repository.pullRequest.numberintegeryes
repository.pullRequest.urlstringyes
repository.enabledAtinteger | nullyes
repository.lastRunobject | nullyesThe repository's latest drift run, whenever it was sent.
repository.lastRun.checkedAtintegeryes
repository.lastRun.driftedintegeryes
repository.lastRun.failedintegeryes
outcome"opened" | "open" | "complete" | "fix_opened"yesopened: a pull request was opened now. open: one was open already. complete: the repository is set up already, so no pull request; only the trusted publisher was registered. fix_opened: its settings file did not check, so a pull request that fixes it was opened, or the open one brought up to date.
pullRequestobject | nullyes
pullRequest.numberintegeryes
pullRequest.urlstringyes
createdbooleanyesTrue when a pull request was opened now.
trustedPublisherobject | nullyesThe trusted publisher for the workflow, or null when the organisation has twenty already.
trustedPublisher.idstringyes
trustedPublisher.namestringyes
trustedPublisher.createdbooleanyes
keylessbooleanyesTrue when the workflow signs in with no key (id-token: write); false while the pinned Action needs PLOTWORK_API_KEY.
sourcesintegeryesHow many diagrams the pull request adds.
planGithubPlanyes
plan.outcome"setup" | "additions" | "complete" | "invalid" | "nothing"yessetup: no settings file yet, so a pull request adds one, the workflow and the diagrams. additions: the repository uses Plotwork, and a pull request adds only what it lacks. complete: it covers everything found, so only CI is registered. invalid: its settings file does not check and is left alone. nothing: nothing to draw.
plan.summarystringyesWhat happens, in one sentence.
plan.addedobject[]yes
plan.added[].namestringyes
plan.added[].formatstringyes
plan.added[].fromstring[]yes
plan.added[].outstringyes
plan.keptstring[]yesThe sources the settings file has, every one left as it is.
plan.workflowobject | nullyesThe workflow written, edited in place (report-drift and id-token: write added), or left as it is.
plan.workflow.action"add" | "edit" | "keep"yes
plan.workflow.filestringyes
plan.suggestionsstring[]yesWhat the workflow still lacks and was not changed, such as an older pin of the Action.
plan.problemsobject[]yesFor invalid: where the settings file does not check, each with a hint.
plan.problems[].codestringyes
plan.problems[].messagestringyes
plan.problems[].lineintegeryes
plan.problems[].columnintegeryes
plan.problems[].hintstring | nullyes
plan.repairobject | nullyesFor invalid: the repair Enable would make.
plan.repair.fixablebooleanyesTrue when every problem has a plain fix, so Enable opens a pull request that fixes the file.
plan.repair.fixesobject[]yes
plan.repair.needsYoustring[]yesWhat the fix leaves as it is for the person: a source that reads no file, a key or value with no plain match.
plan.followUpstring | nullyesFor a fixable invalid: what Enable does once the fix is merged.

See also

DocWhy
API referenceEvery endpoint, and the error envelope
SchemasEvery request and response type
Tool referenceThe operations as callable tools