Workflows requis GitHub Actions
Utilisez l’API REST pour accéder et configurer les workflows requis dans une organisation dans GitHub Actions.
List required workflows
List all required workflows in an organization.
You must authenticate using an access token with the read:org
scope to use this endpoint.
For more information, see "Required Workflows."
Paramètres pour « List required workflows »
En-têtes |
---|
Nom, Type, Description |
accept string Setting to |
Paramètres de chemin d’accès |
Nom, Type, Description |
org string ObligatoireThe organization name. The name is not case sensitive. |
Paramètres de requête |
Nom, Type, Description |
per_page integer The number of results per page (max 100). Default: |
page integer Page number of the results to fetch. Default: |
Codes d’état de la réponse HTTP pour « List required workflows »
Code d’état | Description |
---|---|
200 | OK |
Exemples de code pour « List required workflows »
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/required_workflows
Response
Status: 200
{
"total_count": 2,
"required_workflows": [
{
"id": 30433642,
"name": "Required CI",
"path": ".github/workflows/ci.yml",
"scope": "selected",
"ref": "refs/head/main",
"state": "active",
"selected_repositories_url": "https://api.github.com/organizations/org/actions/required_workflows/1/repositories",
"created_at": "2020-01-22T19:33:08Z",
"updated_at": "2020-01-22T19:33:08Z",
"repository": {
"id": 1296269,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"name": "Hello-World",
"full_name": "octocat/Hello-World",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"private": false,
"html_url": "https://github.com/octocat/Hello-World",
"description": "This your first repo!",
"fork": false,
"url": "https://api.github.com/repos/octocat/Hello-World",
"archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
"assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}",
"blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}",
"collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}",
"commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}",
"compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}",
"contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors",
"deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments",
"downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads",
"events_url": "https://api.github.com/repos/octocat/Hello-World/events",
"forks_url": "https://api.github.com/repos/octocat/Hello-World/forks",
"git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
"git_url": "git:github.com/octocat/Hello-World.git",
"issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
"issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}",
"keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
"labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}",
"languages_url": "https://api.github.com/repos/octocat/Hello-World/languages",
"merges_url": "https://api.github.com/repos/octocat/Hello-World/merges",
"milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}",
"notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
"pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}",
"releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers",
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers",
"subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription",
"tags_url": "https://api.github.com/repos/octocat/Hello-World/tags",
"teams_url": "https://api.github.com/repos/octocat/Hello-World/teams",
"trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks"
}
},
{
"id": 30433643,
"name": "Required Linter",
"path": ".github/workflows/lint.yml",
"scope": "all",
"ref": "refs/head/main",
"state": "active",
"created_at": "2020-01-22T19:33:08Z",
"updated_at": "2020-01-22T19:33:08Z",
"repository": {
"id": 1296269,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"name": "Hello-World",
"full_name": "octocat/Hello-World",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"private": false,
"html_url": "https://github.com/octocat/Hello-World",
"description": "This your first repo!",
"fork": false,
"url": "https://api.github.com/repos/octocat/Hello-World",
"archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
"assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}",
"blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}",
"collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}",
"commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}",
"compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}",
"contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors",
"deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments",
"downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads",
"events_url": "https://api.github.com/repos/octocat/Hello-World/events",
"forks_url": "https://api.github.com/repos/octocat/Hello-World/forks",
"git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
"git_url": "git:github.com/octocat/Hello-World.git",
"issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
"issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}",
"keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
"labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}",
"languages_url": "https://api.github.com/repos/octocat/Hello-World/languages",
"merges_url": "https://api.github.com/repos/octocat/Hello-World/merges",
"milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}",
"notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
"pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}",
"releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers",
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers",
"subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription",
"tags_url": "https://api.github.com/repos/octocat/Hello-World/tags",
"teams_url": "https://api.github.com/repos/octocat/Hello-World/teams",
"trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks"
}
}
]
}
Create a required workflow
Create a required workflow in an organization.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
For more information, see "Required Workflows."
Paramètres pour « Create a required workflow »
En-têtes |
---|
Nom, Type, Description |
accept string Setting to |
Paramètres de chemin d’accès |
Nom, Type, Description |
org string ObligatoireThe organization name. The name is not case sensitive. |
Paramètres du corps |
Nom, Type, Description |
workflow_file_path string ObligatoirePath of the workflow file to be configured as a required workflow. |
repository_id string ObligatoireThe ID of the repository that contains the workflow file. |
scope string Enable the required workflow for all repositories or selected repositories in the organization. Default: Peut être: |
selected_repository_ids array of integers A list of repository IDs where you want to enable the required workflow. You can only provide a list of repository ids when the |
Codes d’état de la réponse HTTP pour « Create a required workflow »
Code d’état | Description |
---|---|
201 | Created |
422 | Validation failed, or the endpoint has been spammed. |
Exemples de code pour « Create a required workflow »
curl -L \
-X POST \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/required_workflows \
-d '{"workflow_file_path":".github/workflows/ci.yaml","repository_id":53,"scope":"selected","selected_repository_ids":[32,91]}'
Response
Status: 201
{
"id": 30433642,
"name": "Required CI",
"path": ".github/workflows/ci.yml",
"scope": "selected",
"ref": "refs/head/main",
"state": "active",
"selected_repositories_url": "https://api.github.com/orgs/octo-org/actions/required_workflows/1/repositories",
"created_at": "2020-01-22T19:33:08Z",
"updated_at": "2020-01-22T19:33:08Z",
"repository": {
"id": 1296269,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"name": "Hello-World",
"full_name": "octocat/Hello-World",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"private": false,
"html_url": "https://github.com/octocat/Hello-World",
"description": "This your first repo!",
"fork": false,
"url": "https://api.github.com/repos/octocat/Hello-World",
"archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
"assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}",
"blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}",
"collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}",
"commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}",
"compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}",
"contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors",
"deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments",
"downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads",
"events_url": "https://api.github.com/repos/octocat/Hello-World/events",
"forks_url": "https://api.github.com/repos/octocat/Hello-World/forks",
"git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
"git_url": "git:github.com/octocat/Hello-World.git",
"issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
"issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}",
"keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
"labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}",
"languages_url": "https://api.github.com/repos/octocat/Hello-World/languages",
"merges_url": "https://api.github.com/repos/octocat/Hello-World/merges",
"milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}",
"notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
"pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}",
"releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers",
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers",
"subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription",
"tags_url": "https://api.github.com/repos/octocat/Hello-World/tags",
"teams_url": "https://api.github.com/repos/octocat/Hello-World/teams",
"trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks"
}
}
Get a required workflow
Get a required workflow configured in an organization.
You must authenticate using an access token with the read:org
scope to use this endpoint.
For more information, see "Required Workflows."
Paramètres pour « Get a required workflow »
En-têtes |
---|
Nom, Type, Description |
accept string Setting to |
Paramètres de chemin d’accès |
Nom, Type, Description |
org string ObligatoireThe organization name. The name is not case sensitive. |
required_workflow_id integer ObligatoireThe unique identifier of the required workflow. |
Codes d’état de la réponse HTTP pour « Get a required workflow »
Code d’état | Description |
---|---|
200 | OK |
Exemples de code pour « Get a required workflow »
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/required_workflows/REQUIRED_WORKFLOW_ID
Response
Status: 200
{
"id": 30433642,
"name": "Required CI",
"path": ".github/workflows/ci.yml",
"scope": "selected",
"ref": "refs/head/main",
"state": "active",
"selected_repositories_url": "https://api.github.com/orgs/octo-org/actions/required_workflows/1/repositories",
"created_at": "2020-01-22T19:33:08Z",
"updated_at": "2020-01-22T19:33:08Z",
"repository": {
"id": 1296269,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"name": "Hello-World",
"full_name": "octocat/Hello-World",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"private": false,
"html_url": "https://github.com/octocat/Hello-World",
"description": "This your first repo!",
"fork": false,
"url": "https://api.github.com/repos/octocat/Hello-World",
"archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
"assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}",
"blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}",
"collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}",
"commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}",
"compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}",
"contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors",
"deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments",
"downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads",
"events_url": "https://api.github.com/repos/octocat/Hello-World/events",
"forks_url": "https://api.github.com/repos/octocat/Hello-World/forks",
"git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
"git_url": "git:github.com/octocat/Hello-World.git",
"issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
"issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}",
"keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
"labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}",
"languages_url": "https://api.github.com/repos/octocat/Hello-World/languages",
"merges_url": "https://api.github.com/repos/octocat/Hello-World/merges",
"milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}",
"notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
"pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}",
"releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers",
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers",
"subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription",
"tags_url": "https://api.github.com/repos/octocat/Hello-World/tags",
"teams_url": "https://api.github.com/repos/octocat/Hello-World/teams",
"trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks"
}
}
Update a required workflow
Update a required workflow in an organization.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
For more information, see "Required Workflows."
Paramètres pour « Update a required workflow »
En-têtes |
---|
Nom, Type, Description |
accept string Setting to |
Paramètres de chemin d’accès |
Nom, Type, Description |
org string ObligatoireThe organization name. The name is not case sensitive. |
required_workflow_id integer ObligatoireThe unique identifier of the required workflow. |
Paramètres du corps |
Nom, Type, Description |
workflow_file_path string Path of the workflow file to be configured as a required workflow. |
repository_id string The ID of the repository that contains the workflow file. |
scope string Enable the required workflow for all repositories or selected repositories in the organization. Default: Peut être: |
selected_repository_ids array of integers A list of repository IDs where you want to enable the required workflow. A list of repository IDs where you want to enable the required workflow. You can only provide a list of repository ids when the |
Codes d’état de la réponse HTTP pour « Update a required workflow »
Code d’état | Description |
---|---|
200 | OK |
422 | Validation failed, or the endpoint has been spammed. |
Exemples de code pour « Update a required workflow »
curl -L \
-X PATCH \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/required_workflows/REQUIRED_WORKFLOW_ID \
-d '{"workflow_file_path":".github/workflows/ci.yaml","repository_id":53,"scope":"selected","selected_repository_ids":[32,91]}'
Response
Status: 200
{
"id": 30433642,
"name": "Required CI",
"path": ".github/workflows/ci.yml",
"scope": "selected",
"ref": "refs/head/main",
"state": "active",
"selected_repositories_url": "https://api.github.com/orgs/octo-org/actions/required_workflows/1/repositories",
"created_at": "2020-01-22T19:33:08Z",
"updated_at": "2020-01-22T19:33:08Z",
"repository": {
"id": 1296269,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"name": "Hello-World",
"full_name": "octocat/Hello-World",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"private": false,
"html_url": "https://github.com/octocat/Hello-World",
"description": "This your first repo!",
"fork": false,
"url": "https://api.github.com/repos/octocat/Hello-World",
"archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
"assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}",
"blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}",
"collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}",
"commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}",
"compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}",
"contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors",
"deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments",
"downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads",
"events_url": "https://api.github.com/repos/octocat/Hello-World/events",
"forks_url": "https://api.github.com/repos/octocat/Hello-World/forks",
"git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
"git_url": "git:github.com/octocat/Hello-World.git",
"issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
"issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}",
"keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
"labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}",
"languages_url": "https://api.github.com/repos/octocat/Hello-World/languages",
"merges_url": "https://api.github.com/repos/octocat/Hello-World/merges",
"milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}",
"notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
"pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}",
"releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers",
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers",
"subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription",
"tags_url": "https://api.github.com/repos/octocat/Hello-World/tags",
"teams_url": "https://api.github.com/repos/octocat/Hello-World/teams",
"trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
"hooks_url": "http://api.github.com/repos/octocat/Hello-World/hooks"
}
}
Delete a required workflow
Deletes a required workflow configured in an organization.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
For more information, see "Required Workflows."
Paramètres pour « Delete a required workflow »
En-têtes |
---|
Nom, Type, Description |
accept string Setting to |
Paramètres de chemin d’accès |
Nom, Type, Description |
org string ObligatoireThe organization name. The name is not case sensitive. |
required_workflow_id integer ObligatoireThe unique identifier of the required workflow. |
Codes d’état de la réponse HTTP pour « Delete a required workflow »
Code d’état | Description |
---|---|
204 | No Content |
Exemples de code pour « Delete a required workflow »
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/required_workflows/REQUIRED_WORKFLOW_ID
Response
Status: 204
List selected repositories for a required workflow
Lists the selected repositories that are configured for a required workflow in an organization. To use this endpoint, the required workflow must be configured to run on selected repositories.
You must authenticate using an access token with the read:org
scope to use this endpoint. GitHub Apps must have the administration
organization permission to use this endpoint.
For more information, see "Required Workflows."
Paramètres pour « List selected repositories for a required workflow »
En-têtes |
---|
Nom, Type, Description |
accept string Setting to |
Paramètres de chemin d’accès |
Nom, Type, Description |
org string ObligatoireThe organization name. The name is not case sensitive. |
required_workflow_id integer ObligatoireThe unique identifier of the required workflow. |
Codes d’état de la réponse HTTP pour « List selected repositories for a required workflow »
Code d’état | Description |
---|---|
200 | Success |
404 | Resource Not Found |
Exemples de code pour « List selected repositories for a required workflow »
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/required_workflows/REQUIRED_WORKFLOW_ID/repositories
Success
Status: 200
{
"total_count": 1,
"repositories": [
{
"id": 1296269,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"name": "Hello-World",
"full_name": "octocat/Hello-World",
"owner": {
"login": "octocat",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octocat_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octocat",
"html_url": "https://github.com/octocat",
"followers_url": "https://api.github.com/users/octocat/followers",
"following_url": "https://api.github.com/users/octocat/following{/other_user}",
"gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
"organizations_url": "https://api.github.com/users/octocat/orgs",
"repos_url": "https://api.github.com/users/octocat/repos",
"events_url": "https://api.github.com/users/octocat/events{/privacy}",
"received_events_url": "https://api.github.com/users/octocat/received_events",
"type": "User",
"site_admin": false
},
"private": false,
"html_url": "https://github.com/octocat/Hello-World",
"description": "This your first repo!",
"fork": false,
"url": "https://api.github.com/repos/octocat/Hello-World",
"archive_url": "https://api.github.com/repos/octocat/Hello-World/{archive_format}{/ref}",
"assignees_url": "https://api.github.com/repos/octocat/Hello-World/assignees{/user}",
"blobs_url": "https://api.github.com/repos/octocat/Hello-World/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/octocat/Hello-World/branches{/branch}",
"collaborators_url": "https://api.github.com/repos/octocat/Hello-World/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/octocat/Hello-World/comments{/number}",
"commits_url": "https://api.github.com/repos/octocat/Hello-World/commits{/sha}",
"compare_url": "https://api.github.com/repos/octocat/Hello-World/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/octocat/Hello-World/contents/{+path}",
"contributors_url": "https://api.github.com/repos/octocat/Hello-World/contributors",
"deployments_url": "https://api.github.com/repos/octocat/Hello-World/deployments",
"downloads_url": "https://api.github.com/repos/octocat/Hello-World/downloads",
"events_url": "https://api.github.com/repos/octocat/Hello-World/events",
"forks_url": "https://api.github.com/repos/octocat/Hello-World/forks",
"git_commits_url": "https://api.github.com/repos/octocat/Hello-World/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/octocat/Hello-World/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/octocat/Hello-World/git/tags{/sha}",
"git_url": "git:github.com/octocat/Hello-World.git",
"issue_comment_url": "https://api.github.com/repos/octocat/Hello-World/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/octocat/Hello-World/issues/events{/number}",
"issues_url": "https://api.github.com/repos/octocat/Hello-World/issues{/number}",
"keys_url": "https://api.github.com/repos/octocat/Hello-World/keys{/key_id}",
"labels_url": "https://api.github.com/repos/octocat/Hello-World/labels{/name}",
"languages_url": "https://api.github.com/repos/octocat/Hello-World/languages",
"merges_url": "https://api.github.com/repos/octocat/Hello-World/merges",
"milestones_url": "https://api.github.com/repos/octocat/Hello-World/milestones{/number}",
"notifications_url": "https://api.github.com/repos/octocat/Hello-World/notifications{?since,all,participating}",
"pulls_url": "https://api.github.com/repos/octocat/Hello-World/pulls{/number}",
"releases_url": "https://api.github.com/repos/octocat/Hello-World/releases{/id}",
"ssh_url": "git@github.com:octocat/Hello-World.git",
"stargazers_url": "https://api.github.com/repos/octocat/Hello-World/stargazers",
"statuses_url": "https://api.github.com/repos/octocat/Hello-World/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/octocat/Hello-World/subscribers",
"subscription_url": "https://api.github.com/repos/octocat/Hello-World/subscription",
"tags_url": "https://api.github.com/repos/octocat/Hello-World/tags",
"teams_url": "https://api.github.com/repos/octocat/Hello-World/teams",
"trees_url": "https://api.github.com/repos/octocat/Hello-World/git/trees{/sha}",
"clone_url": "https://github.com/octocat/Hello-World.git",
"mirror_url": "git:git.example.com/octocat/Hello-World",
"hooks_url": "https://api.github.com/repos/octocat/Hello-World/hooks",
"svn_url": "https://svn.github.com/octocat/Hello-World",
"homepage": "https://github.com",
"language": null,
"forks_count": 9,
"stargazers_count": 80,
"watchers_count": 80,
"size": 108,
"default_branch": "master",
"open_issues_count": 0,
"is_template": true,
"topics": [
"octocat",
"atom",
"electron",
"api"
],
"has_issues": true,
"has_projects": true,
"has_wiki": true,
"has_pages": false,
"has_downloads": true,
"archived": false,
"disabled": false,
"visibility": "public",
"pushed_at": "2011-01-26T19:06:43Z",
"created_at": "2011-01-26T19:01:12Z",
"updated_at": "2011-01-26T19:14:43Z",
"permissions": {
"admin": false,
"push": false,
"pull": true
},
"allow_rebase_merge": true,
"template_repository": null,
"temp_clone_token": "ABTLWHOULUVAXGTRYU7OC2876QJ2O",
"allow_squash_merge": true,
"allow_auto_merge": false,
"delete_branch_on_merge": true,
"allow_merge_commit": true,
"subscribers_count": 42,
"network_count": 0,
"license": {
"key": "mit",
"name": "MIT License",
"url": "https://api.github.com/licenses/mit",
"spdx_id": "MIT",
"node_id": "MDc6TGljZW5zZW1pdA==",
"html_url": "https://github.com/licenses/mit"
},
"forks": 1,
"open_issues": 1,
"watchers": 1
}
]
}
Sets repositories for a required workflow
Sets the repositories for a required workflow that is required for selected repositories.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
For more information, see "Required Workflows."
Paramètres pour « Sets repositories for a required workflow »
En-têtes |
---|
Nom, Type, Description |
accept string Setting to |
Paramètres de chemin d’accès |
Nom, Type, Description |
org string ObligatoireThe organization name. The name is not case sensitive. |
required_workflow_id integer ObligatoireThe unique identifier of the required workflow. |
Paramètres du corps |
Nom, Type, Description |
selected_repository_ids array of integers ObligatoireThe IDs of the repositories for which the workflow should be required. |
Codes d’état de la réponse HTTP pour « Sets repositories for a required workflow »
Code d’état | Description |
---|---|
204 | No Content |
Exemples de code pour « Sets repositories for a required workflow »
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/required_workflows/REQUIRED_WORKFLOW_ID/repositories \
-d '{"selected_repository_ids":[32,91]}'
Response
Status: 204
Add a repository to a required workflow
Adds a repository to a required workflow. To use this endpoint, the required workflow must be configured to run on selected repositories.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
For more information, see "Required Workflows."
Paramètres pour « Add a repository to a required workflow »
En-têtes |
---|
Nom, Type, Description |
accept string Setting to |
Paramètres de chemin d’accès |
Nom, Type, Description |
org string ObligatoireThe organization name. The name is not case sensitive. |
required_workflow_id integer ObligatoireThe unique identifier of the required workflow. |
repository_id integer ObligatoireThe unique identifier of the repository. |
Codes d’état de la réponse HTTP pour « Add a repository to a required workflow »
Code d’état | Description |
---|---|
204 | Success |
404 | Resource Not Found |
422 | Validation Error |
Exemples de code pour « Add a repository to a required workflow »
curl -L \
-X PUT \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/required_workflows/REQUIRED_WORKFLOW_ID/repositories/REPOSITORY_ID
Success
Status: 204
Remove a selected repository from required workflow
Removes a repository from a required workflow. To use this endpoint, the required workflow must be configured to run on selected repositories.
You must authenticate using an access token with the admin:org
scope to use this endpoint.
For more information, see "Required Workflows."
Paramètres pour « Remove a selected repository from required workflow »
En-têtes |
---|
Nom, Type, Description |
accept string Setting to |
Paramètres de chemin d’accès |
Nom, Type, Description |
org string ObligatoireThe organization name. The name is not case sensitive. |
required_workflow_id integer ObligatoireThe unique identifier of the required workflow. |
repository_id integer ObligatoireThe unique identifier of the repository. |
Codes d’état de la réponse HTTP pour « Remove a selected repository from required workflow »
Code d’état | Description |
---|---|
204 | Success |
404 | Resource Not Found |
422 | Validation Error |
Exemples de code pour « Remove a selected repository from required workflow »
curl -L \
-X DELETE \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/orgs/ORG/actions/required_workflows/REQUIRED_WORKFLOW_ID/repositories/REPOSITORY_ID
Success
Status: 204
List repository required workflows
Lists the required workflows in a repository. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the repo
scope. GitHub Apps must have the actions:read
permission to use this endpoint. For more information, see "Required Workflows."
Paramètres pour « List repository required workflows »
En-têtes |
---|
Nom, Type, Description |
accept string Setting to |
Paramètres de chemin d’accès |
Nom, Type, Description |
org string ObligatoireThe organization name. The name is not case sensitive. |
repo string ObligatoireThe name of the repository. The name is not case sensitive. |
Paramètres de requête |
Nom, Type, Description |
per_page integer The number of results per page (max 100). Default: |
page integer Page number of the results to fetch. Default: |
Codes d’état de la réponse HTTP pour « List repository required workflows »
Code d’état | Description |
---|---|
200 | OK |
404 | Resource not found |
Exemples de code pour « List repository required workflows »
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/ORG/REPO/actions/required_workflows
Response
Status: 200
{
"total_count": 1,
"required_workflows": [
{
"id": 161335,
"node_id": "MDg6V29ya2Zsb3cxNjEzMzU=",
"name": "RequiredCI",
"path": ".github/workflows/required_ci.yaml",
"state": "active",
"created_at": "2020-01-08T23:48:37.000-08:00",
"updated_at": "2020-01-08T23:50:21.000-08:00",
"url": "https://api.github.com/repos/octo-org/octo-repo/actions/required_workflows/161335",
"html_url": "https://github.com/octo-org/octo-repo/blob/master/octo-org/hello-world/.github/workflows/required_ci.yaml",
"badge_url": "https://github.com/octo-org/octo-repo/workflows/required/octo-org/hello-world/.github/workflows/required_ci.yaml/badge.svg",
"source_repository": {
"id": 1296269,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"name": "Hello-World",
"full_name": "octo-org/Hello-World",
"owner": {
"login": "octo-org",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octo-org_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octo-org",
"html_url": "https://github.com/octo-org",
"followers_url": "https://api.github.com/users/octo-org/followers",
"following_url": "https://api.github.com/users/octo-org/following{/other_user}",
"gists_url": "https://api.github.com/users/octo-org/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octo-org/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octo-org/subscriptions",
"organizations_url": "https://api.github.com/users/octo-org/orgs",
"repos_url": "https://api.github.com/users/octo-org/repos",
"events_url": "https://api.github.com/users/octo-org/events{/privacy}",
"received_events_url": "https://api.github.com/users/octo-org/received_events",
"type": "User",
"site_admin": false
},
"private": false,
"html_url": "https://github.com/octo-org/Hello-World",
"description": "This your first repo!",
"fork": false,
"url": "https://api.github.com/repos/octo-org/Hello-World",
"archive_url": "https://api.github.com/repos/octo-org/Hello-World/{archive_format}{/ref}",
"assignees_url": "https://api.github.com/repos/octo-org/Hello-World/assignees{/user}",
"blobs_url": "https://api.github.com/repos/octo-org/Hello-World/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/octo-org/Hello-World/branches{/branch}",
"collaborators_url": "https://api.github.com/repos/octo-org/Hello-World/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/octo-org/Hello-World/comments{/number}",
"commits_url": "https://api.github.com/repos/octo-org/Hello-World/commits{/sha}",
"compare_url": "https://api.github.com/repos/octo-org/Hello-World/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/octo-org/Hello-World/contents/{+path}",
"contributors_url": "https://api.github.com/repos/octo-org/Hello-World/contributors",
"deployments_url": "https://api.github.com/repos/octo-org/Hello-World/deployments",
"downloads_url": "https://api.github.com/repos/octo-org/Hello-World/downloads",
"events_url": "https://api.github.com/repos/octo-org/Hello-World/events",
"forks_url": "https://api.github.com/repos/octo-org/Hello-World/forks",
"git_commits_url": "https://api.github.com/repos/octo-org/Hello-World/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/octo-org/Hello-World/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/octo-org/Hello-World/git/tags{/sha}",
"git_url": "git:github.com/octo-org/Hello-World.git",
"issue_comment_url": "https://api.github.com/repos/octo-org/Hello-World/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/octo-org/Hello-World/issues/events{/number}",
"issues_url": "https://api.github.com/repos/octo-org/Hello-World/issues{/number}",
"keys_url": "https://api.github.com/repos/octo-org/Hello-World/keys{/key_id}",
"labels_url": "https://api.github.com/repos/octo-org/Hello-World/labels{/name}",
"languages_url": "https://api.github.com/repos/octo-org/Hello-World/languages",
"merges_url": "https://api.github.com/repos/octo-org/Hello-World/merges",
"milestones_url": "https://api.github.com/repos/octo-org/Hello-World/milestones{/number}",
"notifications_url": "https://api.github.com/repos/octo-org/Hello-World/notifications{?since,all,participating}",
"pulls_url": "https://api.github.com/repos/octo-org/Hello-World/pulls{/number}",
"releases_url": "https://api.github.com/repos/octo-org/Hello-World/releases{/id}",
"ssh_url": "git@github.com:octo-org/Hello-World.git",
"stargazers_url": "https://api.github.com/repos/octo-org/Hello-World/stargazers",
"statuses_url": "https://api.github.com/repos/octo-org/Hello-World/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/octo-org/Hello-World/subscribers",
"subscription_url": "https://api.github.com/repos/octo-org/Hello-World/subscription",
"tags_url": "https://api.github.com/repos/octo-org/Hello-World/tags",
"teams_url": "https://api.github.com/repos/octo-org/Hello-World/teams",
"trees_url": "https://api.github.com/repos/octo-org/Hello-World/git/trees{/sha}",
"hooks_url": "http://api.github.com/repos/octo-org/Hello-World/hooks"
}
}
]
}
Get a required workflow entity for a repository
Gets a specific required workflow present in a repository. Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the repo
scope. GitHub Apps must have the actions:read
permission to use this endpoint. For more information, see "Required Workflows."
Paramètres pour « Get a required workflow entity for a repository »
En-têtes |
---|
Nom, Type, Description |
accept string Setting to |
Paramètres de chemin d’accès |
Nom, Type, Description |
org string ObligatoireThe organization name. The name is not case sensitive. |
repo string ObligatoireThe name of the repository. The name is not case sensitive. |
required_workflow_id_for_repo integer ObligatoireThe ID of the required workflow that has run at least once in a repository. |
Codes d’état de la réponse HTTP pour « Get a required workflow entity for a repository »
Code d’état | Description |
---|---|
200 | OK |
404 | Resource not found |
Exemples de code pour « Get a required workflow entity for a repository »
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/ORG/REPO/actions/required_workflows/REQUIRED_WORKFLOW_ID_FOR_REPO
Response
Status: 200
{
"id": 161335,
"node_id": "MDg6V29ya2Zsb3cxNjEzMzU=",
"name": "RequiredCI",
"path": ".github/workflows/required_ci.yaml",
"state": "active",
"created_at": "2020-01-08T23:48:37.000-08:00",
"updated_at": "2020-01-08T23:50:21.000-08:00",
"url": "https://api.github.com/repos/octo-org/octo-repo/actions/required_workflows/161335",
"html_url": "https://github.com/octo-org/octo-repo/blob/master/octo-org/hello-world/.github/workflows/required_ci.yaml",
"badge_url": "https://github.com/octo-org/octo-repo/workflows/required/octo-org/hello-world/.github/workflows/required_ci.yaml/badge.svg",
"source_repository": {
"id": 1296269,
"node_id": "MDEwOlJlcG9zaXRvcnkxMjk2MjY5",
"name": "Hello-World",
"full_name": "octo-org/Hello-World",
"owner": {
"login": "octo-org",
"id": 1,
"node_id": "MDQ6VXNlcjE=",
"avatar_url": "https://github.com/images/error/octo-org_happy.gif",
"gravatar_id": "",
"url": "https://api.github.com/users/octo-org",
"html_url": "https://github.com/octo-org",
"followers_url": "https://api.github.com/users/octo-org/followers",
"following_url": "https://api.github.com/users/octo-org/following{/other_user}",
"gists_url": "https://api.github.com/users/octo-org/gists{/gist_id}",
"starred_url": "https://api.github.com/users/octo-org/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/octo-org/subscriptions",
"organizations_url": "https://api.github.com/users/octo-org/orgs",
"repos_url": "https://api.github.com/users/octo-org/repos",
"events_url": "https://api.github.com/users/octo-org/events{/privacy}",
"received_events_url": "https://api.github.com/users/octo-org/received_events",
"type": "User",
"site_admin": false
},
"private": false,
"html_url": "https://github.com/octo-org/Hello-World",
"description": "This your first repo!",
"fork": false,
"url": "https://api.github.com/repos/octo-org/Hello-World",
"archive_url": "https://api.github.com/repos/octo-org/Hello-World/{archive_format}{/ref}",
"assignees_url": "https://api.github.com/repos/octo-org/Hello-World/assignees{/user}",
"blobs_url": "https://api.github.com/repos/octo-org/Hello-World/git/blobs{/sha}",
"branches_url": "https://api.github.com/repos/octo-org/Hello-World/branches{/branch}",
"collaborators_url": "https://api.github.com/repos/octo-org/Hello-World/collaborators{/collaborator}",
"comments_url": "https://api.github.com/repos/octo-org/Hello-World/comments{/number}",
"commits_url": "https://api.github.com/repos/octo-org/Hello-World/commits{/sha}",
"compare_url": "https://api.github.com/repos/octo-org/Hello-World/compare/{base}...{head}",
"contents_url": "https://api.github.com/repos/octo-org/Hello-World/contents/{+path}",
"contributors_url": "https://api.github.com/repos/octo-org/Hello-World/contributors",
"deployments_url": "https://api.github.com/repos/octo-org/Hello-World/deployments",
"downloads_url": "https://api.github.com/repos/octo-org/Hello-World/downloads",
"events_url": "https://api.github.com/repos/octo-org/Hello-World/events",
"forks_url": "https://api.github.com/repos/octo-org/Hello-World/forks",
"git_commits_url": "https://api.github.com/repos/octo-org/Hello-World/git/commits{/sha}",
"git_refs_url": "https://api.github.com/repos/octo-org/Hello-World/git/refs{/sha}",
"git_tags_url": "https://api.github.com/repos/octo-org/Hello-World/git/tags{/sha}",
"git_url": "git:github.com/octo-org/Hello-World.git",
"issue_comment_url": "https://api.github.com/repos/octo-org/Hello-World/issues/comments{/number}",
"issue_events_url": "https://api.github.com/repos/octo-org/Hello-World/issues/events{/number}",
"issues_url": "https://api.github.com/repos/octo-org/Hello-World/issues{/number}",
"keys_url": "https://api.github.com/repos/octo-org/Hello-World/keys{/key_id}",
"labels_url": "https://api.github.com/repos/octo-org/Hello-World/labels{/name}",
"languages_url": "https://api.github.com/repos/octo-org/Hello-World/languages",
"merges_url": "https://api.github.com/repos/octo-org/Hello-World/merges",
"milestones_url": "https://api.github.com/repos/octo-org/Hello-World/milestones{/number}",
"notifications_url": "https://api.github.com/repos/octo-org/Hello-World/notifications{?since,all,participating}",
"pulls_url": "https://api.github.com/repos/octo-org/Hello-World/pulls{/number}",
"releases_url": "https://api.github.com/repos/octo-org/Hello-World/releases{/id}",
"ssh_url": "git@github.com:octo-org/Hello-World.git",
"stargazers_url": "https://api.github.com/repos/octo-org/Hello-World/stargazers",
"statuses_url": "https://api.github.com/repos/octo-org/Hello-World/statuses/{sha}",
"subscribers_url": "https://api.github.com/repos/octo-org/Hello-World/subscribers",
"subscription_url": "https://api.github.com/repos/octo-org/Hello-World/subscription",
"tags_url": "https://api.github.com/repos/octo-org/Hello-World/tags",
"teams_url": "https://api.github.com/repos/octo-org/Hello-World/teams",
"trees_url": "https://api.github.com/repos/octo-org/Hello-World/git/trees{/sha}",
"hooks_url": "http://api.github.com/repos/octo-org/Hello-World/hooks"
}
}
Get required workflow usage
Gets the number of billable minutes used by a specific required workflow during the current billing cycle.
Billable minutes only apply to required workflows running in private repositories that use GitHub Enterprise Cloud-hosted runners. Usage is listed for each GitHub Enterprise Cloud-hosted runner operating system in milliseconds. Any job re-runs are also included in the usage. The usage does not include the multiplier for macOS and Windows runners and is not rounded up to the nearest whole minute. For more information, see "Managing billing for GitHub Actions."
Anyone with read access to the repository can use this endpoint. If the repository is private you must use an access token with the repo
scope. GitHub Apps must have the actions:read
permission to use this endpoint.
Paramètres pour « Get required workflow usage »
En-têtes |
---|
Nom, Type, Description |
accept string Setting to |
Paramètres de chemin d’accès |
Nom, Type, Description |
org string ObligatoireThe organization name. The name is not case sensitive. |
repo string ObligatoireThe name of the repository. The name is not case sensitive. |
required_workflow_id_for_repo integer ObligatoireThe ID of the required workflow that has run at least once in a repository. |
Codes d’état de la réponse HTTP pour « Get required workflow usage »
Code d’état | Description |
---|---|
200 | OK |
404 | Resource not found |
Exemples de code pour « Get required workflow usage »
curl -L \
-H "Accept: application/vnd.github+json" \
-H "Authorization: Bearer <YOUR-TOKEN>"\
-H "X-GitHub-Api-Version: 2022-11-28" \
https://api.github.com/repos/ORG/REPO/actions/required_workflows/REQUIRED_WORKFLOW_ID_FOR_REPO/timing
Response
Status: 200
{
"billable": {
"UBUNTU": {
"total_ms": 180000
},
"MACOS": {
"total_ms": 240000
},
"WINDOWS": {
"total_ms": 300000
}
}
}