@@ -10,6 +10,19 @@ import { Tooltip } from "react-tooltip";
1010import Tabs from '@theme/Tabs' ;
1111import TabItem from '@theme/TabItem' ;
1212
13+ // GitHub GraphQL MergeStateStatus documentation
14+ // Reference: https://docs.github.com/en/graphql/reference/enums#mergestatestatus
15+ const CI_STATUS_DESCRIPTIONS = {
16+ clean : "Mergeable and passing commit status." ,
17+ unstable : "Mergeable with non-passing commit status." ,
18+ behind : "The head ref is out of date." ,
19+ blocked : "The merge is blocked." ,
20+ dirty : "The merge commit cannot be cleanly created." ,
21+ draft : "The merge is blocked due to the pull request being a draft." ,
22+ has_hooks : "Mergeable with passing commit status and pre-receive hooks." ,
23+ unknown : "The state cannot currently be determined."
24+ } ;
25+
1326// { Done, In PR, Awaiting PR, Awaiting parents, Not solvable, Bot error }
1427// The third value is a boolean representing the default display state on load
1528// 'true' means hidden, 'false' means visible
@@ -39,6 +52,26 @@ export function measureProgress(details) {
3952 return { done, percentage, total } ;
4053}
4154
55+ function getStatusBadgeClass ( prStatus ) {
56+ switch ( prStatus ) {
57+ case "clean" :
58+ return "success" ;
59+ case "unstable" :
60+ return "danger" ;
61+ case "draft" :
62+ return "secondary" ;
63+ case "behind" :
64+ case "blocked" :
65+ case "dirty" :
66+ return "warning" ;
67+ case "has_hooks" :
68+ return "info" ;
69+ case "unknown" :
70+ default :
71+ return "secondary" ;
72+ }
73+ }
74+
4275export default function MigrationDetails ( ) {
4376 const location = useLocation ( ) ;
4477 const { siteConfig } = useDocusaurusContext ( ) ;
@@ -139,6 +172,14 @@ export default function MigrationDetails() {
139172 }
140173 </ div >
141174 </ div >
175+ < div className = { `card margin-top--md` } >
176+ < div className = "card__header" >
177+ < h3 > CI Status Legend</ h3 >
178+ </ div >
179+ < div className = "card__body" >
180+ < CIStatusLegend />
181+ </ div >
182+ </ div >
142183 </ main >
143184 </ Layout >
144185 ) ;
@@ -375,6 +416,9 @@ function Row({ children }) {
375416 const total_children = feedstock [ "num_descendants" ] ;
376417 const href = feedstock [ "pr_url" ] ;
377418 const details = feedstock [ "pre_pr_migrator_status" ] ;
419+ const pr_status = feedstock [ "pr_status" ] ;
420+
421+
378422 return ( < >
379423 < tr >
380424 < td >
@@ -391,15 +435,12 @@ function Row({ children }) {
391435 </ td >
392436 < td style = { { textAlign : "center" } } > { TITLES [ status ] } </ td >
393437 < td style = { { textAlign : "center" } } >
394- { feedstock [ "pr_status" ] ? (
395- < span className = { `badge badge--${
396- feedstock [ "pr_status" ] === "clean" ? "success" :
397- feedstock [ "pr_status" ] === "unstable" ? "danger" :
398- "warning"
399- } `} >
400- { feedstock [ "pr_status" ] === "clean" ? "passing" :
401- feedstock [ "pr_status" ] === "unstable" ? "failing" :
402- feedstock [ "pr_status" ] }
438+ { pr_status ? (
439+ < span
440+ className = { `badge badge--${ getStatusBadgeClass ( pr_status ) } ` }
441+ title = { CI_STATUS_DESCRIPTIONS [ pr_status ] || pr_status }
442+ >
443+ { pr_status }
403444 </ span >
404445 ) : (
405446 < span > —</ span >
@@ -421,6 +462,20 @@ function Row({ children }) {
421462 </ > ) ;
422463}
423464
465+ function CIStatusLegend ( ) {
466+ return (
467+ < div className = { styles . ci_status_legend } >
468+ { Object . entries ( CI_STATUS_DESCRIPTIONS ) . map ( ( [ status , description ] ) => (
469+ < div key = { status } className = { styles . ci_status_item } >
470+ < span className = { `badge badge--${ getStatusBadgeClass ( status ) } ` } > { status } </ span >
471+ < span > { description } </ span >
472+ </ div >
473+ ) ) }
474+ < a href = "https://docs.github.com/en/graphql/reference/enums#mergestatestatus" target = "_blank" rel = "noopener noreferrer" > See GitHub Docs</ a >
475+ </ div >
476+ ) ;
477+ }
478+
424479async function checkPausedOrClosed ( name ) {
425480 for ( const status of [ "paused" , "closed" ] ) {
426481 try {
0 commit comments