Skip to content

Commit

Permalink
Merge branch 'main' into next
Browse files Browse the repository at this point in the history
  • Loading branch information
caugner committed Apr 26, 2024
2 parents 98ea663 + e74ffd5 commit eb5ca72
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 15 deletions.
19 changes: 6 additions & 13 deletions .github/workflows/stage-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ env:
DEFAULT_DEPLOYMENT_PREFIX: "main"
DEFAULT_NOTES: ""
DEFAULT_LOG_EACH_SUCCESSFUL_UPLOAD: "false"
DEFAULT_REF: next

on:
schedule:
Expand All @@ -22,10 +21,6 @@ on:

workflow_dispatch:
inputs:
ref:
description: "Branch to deploy (default: next)"
required: false

notes:
description: "Notes"
required: false
Expand Down Expand Up @@ -67,19 +62,20 @@ permissions:
jobs:
trigger:
runs-on: ubuntu-latest
if: ${{ github.repository == 'mdn/yari' && github.event.schedule != '' }}

# When run from `main` branch (schedule or manual), trigger workflow on `next` branch instead.
if: ${{ github.repository == 'mdn/yari' && github.ref_name == 'main' }}
steps:
# The schedule runs the `main` version, but we want the `next` version.
- run: gh workflow run "${{ github.workflow }}" --repo "${{ github.repository }}" --ref "${{ env.DEFAULT_REF }}"
- run: gh workflow run "${{ github.workflow }}" --repo "${{ github.repository }}" --ref "next"
env:
GH_TOKEN: ${{ secrets.AUTOMERGE_TOKEN }}

build:
environment: stage
runs-on: ubuntu-latest

# Only run the scheduled workflows on the main repo.
if: ${{ github.repository == 'mdn/yari' && github.event.schedule == '' }}
# We only ever want to deploy the `next` branch to stage.
if: ${{ github.repository == 'mdn/yari' && github.ref_name == 'next' }}

steps:
# Our usecase is a bit complicated. When the cron schedule runs this workflow,
Expand All @@ -93,15 +89,12 @@ jobs:
run: |
echo "DEPLOYER_BUCKET_PREFIX=${{ github.event.inputs.deployment_prefix || env.DEFAULT_DEPLOYMENT_PREFIX }}" >> $GITHUB_ENV
echo "DEPLOYER_LOG_EACH_SUCCESSFUL_UPLOAD=${{ github.event.inputs.log_each_successful_upload || env.DEFAULT_LOG_EACH_SUCCESSFUL_UPLOAD }}" >> $GITHUB_ENV
echo "REF=${{ github.event.inputs.ref || env.DEFAULT_REF }}" >> $GITHUB_ENV
- uses: actions/checkout@v4
with:
ref: ${{ env.REF }}
fetch-depth: 0

- name: Merge main
if: ${{ env.REF != 'main' }}
run: |
git config --global user.email "[email protected]"
git config --global user.name "mdn-bot"
Expand Down
4 changes: 4 additions & 0 deletions client/src/app.scss
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@ main {
width: 1px !important;
}

.contents {
display: contents;
}

.hidden {
display: none;
}
Expand Down
9 changes: 8 additions & 1 deletion client/src/ui/molecules/dropdown/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ export function DropdownMenuWrapper({

export function DropdownMenu({
children,
alwaysRenderChildren = false,
onClose = () => {},
}: {
children: React.ReactNode;
alwaysRenderChildren?: boolean;
onClose?: (event?: Event) => void;
}) {
const { isOpen, wrapperRef, close, disableAutoClose } =
Expand All @@ -82,7 +84,12 @@ export function DropdownMenu({
onClose(event);
}
});
if (!isOpen) return null;

if (alwaysRenderChildren) {
return <div className={isOpen ? "contents" : "hidden"}>{children}</div>;
} else if (!isOpen) {
return null;
}

return <>{children}</>;
}
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ export function LanguageMenu({
{native}
</Button>

<DropdownMenu>
<DropdownMenu alwaysRenderChildren>
<Submenu menuEntry={menuEntry} />
</DropdownMenu>
</DropdownMenuWrapper>
Expand Down

0 comments on commit eb5ca72

Please sign in to comment.