feat: add deployment statuses to GithubDeployments plugin
Signed-off-by: sam-robson <srobson@gocardless.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-github-deployments': minor
|
||||
---
|
||||
|
||||
Add deployment statuses to the GithubDeployments plugin
|
||||
@@ -53,6 +53,10 @@ const getBaseUrl = (
|
||||
return config?.config.apiBaseUrl;
|
||||
};
|
||||
|
||||
type Node = {
|
||||
logUrl?: string;
|
||||
};
|
||||
|
||||
export type GithubDeployment = {
|
||||
environment: string;
|
||||
state: string;
|
||||
@@ -61,9 +65,15 @@ export type GithubDeployment = {
|
||||
abbreviatedOid: string;
|
||||
commitUrl: string;
|
||||
};
|
||||
statuses: {
|
||||
nodes: Node[];
|
||||
};
|
||||
creator: {
|
||||
login: string;
|
||||
};
|
||||
repository: {
|
||||
nameWithOwner: string;
|
||||
};
|
||||
payload: string;
|
||||
};
|
||||
|
||||
@@ -89,9 +99,9 @@ export type Options = {
|
||||
};
|
||||
|
||||
const deploymentsQuery = `
|
||||
query deployments($owner: String!, $repo: String!, $last: Int) {
|
||||
query deployments($owner: String!, $repo: String!, $lastDeployments: Int, $lastStatuses: Int) {
|
||||
repository(owner: $owner, name: $repo) {
|
||||
deployments(last: $last) {
|
||||
deployments(last: $lastDeployments) {
|
||||
nodes {
|
||||
state
|
||||
environment
|
||||
@@ -100,9 +110,17 @@ query deployments($owner: String!, $repo: String!, $last: Int) {
|
||||
abbreviatedOid
|
||||
commitUrl
|
||||
}
|
||||
statuses(last: $lastStatuses) {
|
||||
nodes {
|
||||
logUrl
|
||||
}
|
||||
}
|
||||
creator {
|
||||
login
|
||||
}
|
||||
repository {
|
||||
nameWithOwner
|
||||
}
|
||||
payload
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,13 @@ export const responseStub: QueryResponse = {
|
||||
creator: {
|
||||
login: 'robot-user-001',
|
||||
},
|
||||
payload: '{"target":"moon"}',
|
||||
statuses: {
|
||||
nodes: [{ logUrl: 'taskrun/example-run' }],
|
||||
},
|
||||
repository: {
|
||||
nameWithOwner: 'org/owner',
|
||||
},
|
||||
payload: '',
|
||||
},
|
||||
{
|
||||
state: 'pending',
|
||||
@@ -62,9 +68,15 @@ export const responseStub: QueryResponse = {
|
||||
abbreviatedOid: '54321',
|
||||
},
|
||||
creator: {
|
||||
login: 'robot-user-002',
|
||||
login: 'robot-user-001',
|
||||
},
|
||||
payload: '{"target":"sun"}',
|
||||
statuses: {
|
||||
nodes: [{ logUrl: '' }],
|
||||
},
|
||||
repository: {
|
||||
nameWithOwner: 'org/owner',
|
||||
},
|
||||
payload: '',
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -86,6 +98,12 @@ export const refreshedResponseStub: QueryResponse = {
|
||||
creator: {
|
||||
login: 'robot-user-001',
|
||||
},
|
||||
statuses: {
|
||||
nodes: [{ logUrl: 'taskrun/example-run' }],
|
||||
},
|
||||
repository: {
|
||||
nameWithOwner: 'org/owner',
|
||||
},
|
||||
payload: '',
|
||||
},
|
||||
{
|
||||
@@ -97,7 +115,13 @@ export const refreshedResponseStub: QueryResponse = {
|
||||
abbreviatedOid: '54321',
|
||||
},
|
||||
creator: {
|
||||
login: 'robot-user-002',
|
||||
login: 'robot-user-001',
|
||||
},
|
||||
statuses: {
|
||||
nodes: [{ logUrl: 'taskrun/example-run' }],
|
||||
},
|
||||
repository: {
|
||||
nameWithOwner: 'org/owner',
|
||||
},
|
||||
payload: '',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user