Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 2 additions & 1 deletion components/metadata.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export function formatMetadataResult({ status, data, metadata, checker }) {
owner: data.owner,
repo: data.repo,
number: data.prid,
url: data.pr.url
url: data.pr.url,
labels: data.pr.labels.nodes.map(({ name }) => name)
},
metadata,
reasonCodes,
Expand Down
5 changes: 3 additions & 2 deletions docs/git-node.md
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,9 @@ git node metadata 167 --repo llnode --readme ../node/README.md
When `--json` is used, stdout contains a JSON object and progress/check output
is written to stderr. The command still exits non-zero when the pull request is
not ready to land. The JSON includes `ready`, `readiness`, `exitCode`,
`metadata`, `reasonCodes`, and `reasons`. `reasonCodes` is a de-duplicated list
of stable machine-readable codes such as `missing-approval`,
`pullRequest`, `metadata`, `reasonCodes`, and `reasons`. `pullRequest.labels` is
an array of the pull request's label names. `reasonCodes` is a de-duplicated
list of stable machine-readable codes such as `missing-approval`,
`missing-tsc-approval`, `wait-time`, `missing-github-ci`, `pending-github-ci`,
`conflict`, `requested-changes`, and `stale-review`.

Expand Down
21 changes: 16 additions & 5 deletions test/unit/metadata.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,13 @@ describe('metadata command helpers', () => {
repo: 'node',
prid: 12345,
pr: {
url: 'https://github.com/nodejs/node/pull/12345'
url: 'https://github.com/nodejs/node/pull/12345',
labels: {
nodes: [
{ name: 'commit-queue' },
{ name: 'fast-track' }
]
}
}
},
metadata: 'PR-URL: https://github.com/nodejs/node/pull/12345\n',
Expand All @@ -43,7 +49,8 @@ describe('metadata command helpers', () => {
owner: 'nodejs',
repo: 'node',
number: 12345,
url: 'https://github.com/nodejs/node/pull/12345'
url: 'https://github.com/nodejs/node/pull/12345',
labels: ['commit-queue', 'fast-track']
},
metadata: 'PR-URL: https://github.com/nodejs/node/pull/12345\n',
reasonCodes: [PR_CHECK_REASON_CODES.WAIT_TIME],
Expand All @@ -59,7 +66,8 @@ describe('metadata command helpers', () => {
repo: 'node',
prid: 12345,
pr: {
url: 'https://github.com/nodejs/node/pull/12345'
url: 'https://github.com/nodejs/node/pull/12345',
labels: { nodes: [] }
}
},
metadata: 'PR-URL: https://github.com/nodejs/node/pull/12345\n',
Expand All @@ -75,6 +83,7 @@ describe('metadata command helpers', () => {

assert.strictEqual(result.readiness, METADATA_READINESS.DEFERRABLE);
assert.strictEqual(result.exitCode, METADATA_EXIT_CODES.DEFERRABLE);
assert.deepStrictEqual(result.pullRequest.labels, []);
});

it('classifies missing approvals as failed', () => {
Expand All @@ -85,7 +94,8 @@ describe('metadata command helpers', () => {
repo: 'node',
prid: 12345,
pr: {
url: 'https://github.com/nodejs/node/pull/12345'
url: 'https://github.com/nodejs/node/pull/12345',
labels: { nodes: [] }
}
},
metadata: 'PR-URL: https://github.com/nodejs/node/pull/12345\n',
Expand All @@ -111,7 +121,8 @@ describe('metadata command helpers', () => {
repo: 'node',
prid: 12345,
pr: {
url: 'https://github.com/nodejs/node/pull/12345'
url: 'https://github.com/nodejs/node/pull/12345',
labels: { nodes: [] }
}
},
metadata: 'PR-URL: https://github.com/nodejs/node/pull/12345\n',
Expand Down
Loading