5
.github/workflows/openapi-decorate.yml
vendored
5
.github/workflows/openapi-decorate.yml
vendored
@@ -32,6 +32,11 @@ jobs:
|
||||
|
||||
- name: Checkout repository code
|
||||
uses: actions/checkout@ec3a7ce113134d7a93b817d10a8272cb61118579
|
||||
with:
|
||||
# actions/checkout by default will leave you in a detached head state
|
||||
# so we need to specify the PR head ref explicitly since we're making
|
||||
# changes that we want to commit to the branch.
|
||||
ref: ${{ github.event.pull_request.head.ref }}
|
||||
|
||||
- name: Setup node
|
||||
uses: actions/setup-node@1f8c6b94b26d0feae1e387ca63ccbdc44d27b561
|
||||
|
||||
@@ -16,26 +16,6 @@ const SectionToLabelMap: Record<string, string> = {
|
||||
backups: 'Backups',
|
||||
}
|
||||
|
||||
const LabelColorMap = {
|
||||
features: 'color-bg-success-emphasis',
|
||||
bugs: 'color-bg-attention-emphasis',
|
||||
known_issues: 'color-bg-accent-emphasis',
|
||||
security_fixes: 'color-bg-sponsors-emphasis',
|
||||
changes: 'color-bg-success-emphasis',
|
||||
deprecations: 'color-bg-done-emphasis',
|
||||
backups: 'color-bg-severe-emphasis',
|
||||
}
|
||||
|
||||
const HeadingColorMap = {
|
||||
features: 'color-fg-success',
|
||||
bugs: 'color-fg-attention',
|
||||
known_issues: 'color-fg-accent',
|
||||
security_fixes: 'color-fg-sponsors',
|
||||
changes: 'color-fg-success',
|
||||
deprecations: 'color-fg-done',
|
||||
backups: 'color-fg-severe',
|
||||
}
|
||||
|
||||
type Props = {
|
||||
patch: ReleaseNotePatch
|
||||
withReleaseNoteLabel?: boolean
|
||||
@@ -45,32 +25,17 @@ export function PatchNotes({ patch, withReleaseNoteLabel }: Props) {
|
||||
<>
|
||||
{Object.entries(patch.sections).map(([key, sectionItems], i, arr) => {
|
||||
const isLast = i === arr.length - 1
|
||||
const primaryLabelColor =
|
||||
LabelColorMap[key as keyof typeof LabelColorMap] || LabelColorMap.features
|
||||
const primaryHeadingColor =
|
||||
HeadingColorMap[key as keyof typeof HeadingColorMap] || HeadingColorMap.features
|
||||
return (
|
||||
<div
|
||||
key={key}
|
||||
className={cx(
|
||||
'py-6 d-block d-xl-flex gutter-xl flex-items-baseline',
|
||||
'py-6 d-block d-xl-flex flex-justify-center',
|
||||
!withReleaseNoteLabel && 'mx-6',
|
||||
!isLast && 'border-bottom'
|
||||
)}
|
||||
>
|
||||
{withReleaseNoteLabel && (
|
||||
<div className="col-12 col-xl-3 mb-5">
|
||||
<span
|
||||
className={cx(
|
||||
'px-3 py-2 color-fg-on-emphasis text-small text-bold text-uppercase',
|
||||
primaryLabelColor
|
||||
)}
|
||||
>
|
||||
{SectionToLabelMap[key] || 'INVALID SECTION'}
|
||||
</span>
|
||||
</div>
|
||||
)}
|
||||
<ul className={cx(withReleaseNoteLabel && 'col-xl-9', 'col-12')}>
|
||||
<h3>{SectionToLabelMap[key] || 'INVALID SECTION'}</h3>
|
||||
{sectionItems.map((item) => {
|
||||
if (typeof item === 'string') {
|
||||
return <li key={item} className="f4" dangerouslySetInnerHTML={{ __html: item }} />
|
||||
@@ -79,17 +44,8 @@ export function PatchNotes({ patch, withReleaseNoteLabel }: Props) {
|
||||
const slug = item.heading ? slugger.slug(item.heading) : ''
|
||||
return (
|
||||
<Fragment key={slug}>
|
||||
<h4
|
||||
id={slug}
|
||||
className={cx(
|
||||
styles.sectionHeading,
|
||||
primaryHeadingColor,
|
||||
'text-uppercase text-bold f4'
|
||||
)}
|
||||
>
|
||||
<Link href={`#${slug}`} className="color-fg-inherit">
|
||||
{item.heading}
|
||||
</Link>
|
||||
<h4 id={slug} className={cx(styles.sectionHeading, 'text-bold f4')}>
|
||||
<Link href={`#${slug}`}>{item.heading}</Link>
|
||||
</h4>
|
||||
{item.notes.map((note) => {
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user