Skip to content

Commit

Permalink
Merge branch 'stage' into MWPW-161870
Browse files Browse the repository at this point in the history
  • Loading branch information
seanchoi-dev committed Dec 9, 2024
2 parents bde3f92 + 39eafc8 commit 163e0d2
Show file tree
Hide file tree
Showing 199 changed files with 6,266 additions and 915 deletions.
1 change: 1 addition & 0 deletions .eslintrc-code-compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ module.exports = {
],
ignorePatterns: [
'/libs/deps/*',
'/libs/navigation/dist/*',
'/tools/loc/*',
],
};
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ module.exports = {
'/libs/features/mas/*',
'/tools/loc/*',
'/libs/features/spectrum-web-components/*',
'/libs/navigation/dist/*',
],
plugins: [
'chai-friendly',
Expand Down
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE/gnav.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ Resolves: [MWPW-111111](https://jira.corp.adobe.com/browse/MWPW-111111)
- After: https://main--blog--adobecom.hlx.page/?milolibs=<branch>--milo--<owner>

**Milo:**
- Before: https://main--milo--adobecom.hlx.page/ch_de/drafts/ramuntea/gnav-refactor?martech=off
- After: https://<branch>--milo--<owner>.hlx.page/ch_de/drafts/ramuntea/gnav-refactor?martech=off
- Before: https://main--milo--adobecom.aem.page/ch_de/drafts/ramuntea/gnav-refactor?martech=off
- After: https://<branch>--milo--<owner>.aem.page/ch_de/drafts/ramuntea/gnav-refactor?martech=off
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
Resolves: [MWPW-NUMBER](https://jira.corp.adobe.com/browse/MWPW-NUMBER)

**Test URLs:**
- Before: https://main--milo--adobecom.hlx.page/?martech=off
- After: https://<branch>--milo--adobecom.hlx.page/?martech=off
- Before: https://main--milo--adobecom.aem.page/?martech=off
- After: https://<branch>--milo--adobecom.aem.page/?martech=off
11 changes: 9 additions & 2 deletions .github/workflows/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ const RCPDates = [
},
];

const isWithinRCP = (offset = 0) => {
const isShortRCP = (start, end) => {
return ((end - start) / (1000 * 60 * 60)) < 24;
};

const isWithinRCP = ({ offset = 0, excludeShortRCP = false } = {}) => {
const now = new Date();
if (now.getFullYear() !== CURRENT_YEAR) {
console.log(`ADD NEW RCPs for ${CURRENT_YEAR + 1}`);
Expand All @@ -53,7 +57,9 @@ const isWithinRCP = (offset = 0) => {
if (RCPDates.some(({ start, end }) => {
const adjustedStart = new Date(start);
adjustedStart.setDate(adjustedStart.getDate() - offset);
return start <= now && now <= end
const match = adjustedStart <= now && now <= end;
if (!match || (excludeShortRCP && isShortRCP(start, end))) return false;
return true;
})) {
console.log(
'Current date is within a RCP (2 days earlier for stage, to keep stage clean & make CSO contributions during an RCP easier). Stopping execution.'
Expand Down Expand Up @@ -148,6 +154,7 @@ module.exports = {
getLocalConfigs,
slackNotification,
pulls: { addLabels, addFiles, getChecks, getReviews },
isShortRCP,
isWithinRCP,
RCPDates,
};
3 changes: 2 additions & 1 deletion .github/workflows/merge-to-main.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const {
const PR_TITLE = '[Release] Stage to Main';
const STAGE = 'stage';
const PROD = 'main';
const MIN_SOT_APPROVALS = process.env.MIN_SOT_APPROVALS ? Number(process.env.MIN_SOT_APPROVALS) : 4;

let github, owner, repo;

Expand Down Expand Up @@ -40,7 +41,7 @@ const main = async (params) => {
const stageToMainPR = await getStageToMainPR();
const signOffs = stageToMainPR?.labels.filter((l) => l.includes('SOT'));
console.log(`${signOffs.length} SOT labels on PR ${stageToMainPR.number}`);
if (signOffs.length >= 4) {
if (signOffs.length >= MIN_SOT_APPROVALS) {
console.log('Stage to Main PR has all required labels. Merging...');
await github.rest.pulls.merge({
owner,
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/merge-to-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

env:
MILO_RELEASE_SLACK_WH: ${{ secrets.MILO_RELEASE_SLACK_WH }}
MIN_SOT_APPROVALS: ${{ secrets.MIN_SOT_APPROVALS }}

jobs:
merge-to-main:
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/merge-to-stage.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,20 @@ const LABELS = {
zeroImpact: 'zero-impact',
};
const TEAM_MENTIONS = [
'@adobecom/miq-sot',
'@adobecom/bacom-sot',
'@adobecom/homepage-sot',
'@adobecom/creative-cloud-sot',
'@adobecom/document-cloud-sot',
'@adobecom/express-sot',
'@adobecom/homepage-sot',
'@adobecom/miq-sot',
];
const SLACK = {
merge: ({ html_url, number, title, prefix = '' }) => `:merged: PR merged to stage: ${prefix} <${html_url}|${number}: ${title}>.`,
openedSyncPr: ({ html_url, number }) => `:fast_forward: Created <${html_url}|Stage to Main PR ${number}>`,
};

let github;
let owner;
let github;
let owner;
let repo;

let body = `
Expand All @@ -44,8 +45,8 @@ let body = `
**Acrobat:** https://www.stage.adobe.com/acrobat/online/sign-pdf.html
**Milo:**
- Before: https://main--milo--adobecom.hlx.live/?martech=off
- After: https://stage--milo--adobecom.hlx.live/?martech=off
- Before: https://main--milo--adobecom.aem.live/?martech=off
- After: https://stage--milo--adobecom.aem.live/?martech=off
`;

const isHighPrio = (labels) => labels.includes(LABELS.highPriority);
Expand Down Expand Up @@ -230,7 +231,7 @@ const main = async (params) => {
github = params.github;
owner = params.context.repo.owner;
repo = params.context.repo.repo;
if (isWithinRCP(process.env.STAGE_RCP_OFFSET_DAYS || 2)) return console.log('Stopped, within RCP period.');
if (isWithinRCP({ offset: process.env.STAGE_RCP_OFFSET_DAYS || 2, excludeShortRCP: true })) return console.log('Stopped, within RCP period.');

try {
const stageToMainPR = await getStageToMainPR();
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/rcp-notifier.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@ const {
slackNotification,
getLocalConfigs,
RCPDates,
isShortRCP,
} = require('./helpers.js');

const isWithin24Hours = (targetDate) =>
Math.abs(new Date() - targetDate) <= 24 * 60 * 60 * 1000;
const isWithin24Hours = (targetDate) => {
const now = new Date();
return now < targetDate && new Date(now.getTime() + 24 * 60 * 60 * 1000) > targetDate;
};

const calculateDateOffset = (date, offset) => {
const newDate = new Date(date);
Expand All @@ -19,17 +22,18 @@ const main = async () => {
for (const rcp of RCPDates) {
const start = new Date(rcp.start);
const end = new Date(rcp.end);
const isShort = isShortRCP(start, end);
const tenDaysBefore = calculateDateOffset(start, 10);
const fourDaysBefore = calculateDateOffset(start, 4);
const stageOffset = Number(process.env.STAGE_RCP_OFFSET_DAYS) || 2;
const slackText = (days) =>
`Reminder RCP starts in ${days} days: from ${start.toUTCString()} to ${end.toUTCString()}. Merges to stage will be disabled beginning ${calculateDateOffset(start, stageOffset).toUTCString()}.`;
if (isWithin24Hours(tenDaysBefore)) {
if (isWithin24Hours(tenDaysBefore) && !isShort) {
console.log('Is within 24 hours of 10 days before RCP');
await slackNotification(slackText(10), process.env.MILO_DEV_HOOK);
}

if (isWithin24Hours(fourDaysBefore)) {
if (isWithin24Hours(fourDaysBefore) && !isShort) {
console.log('Is within 24 hours of 4 days before RCP');
await slackNotification(slackText(4), process.env.MILO_DEV_HOOK);
}
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/release-standalone-feds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Create a Release for Standalone Feds GlobalNav and Footer
on:
workflow_dispatch:
inputs:
version:
description: 'Version'
required: true
type: string

permissions:
contents: write

jobs:
release-feds:
name: Release Standalone Feds
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [20.x]
defaults:
run:
working-directory: ./libs/navigation
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm install

- name: Build Files
run: node ./build.mjs

- name: Generate tarball
run: npm pack

- name: Create Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create "feds-standalone-v${{ inputs.version }}" \
--repo="$GITHUB_REPOSITORY" \
--title="@adobecom/standalone-feds v${{ inputs.version }} Release" \
--generate-notes
- name: Upload Files to Release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload "feds-standalone-v${{ inputs.version }}" "adobecom-standalone-feds-${{ inputs.version }}.tgz"
6 changes: 2 additions & 4 deletions .github/workflows/run-nala-circleci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
name: Nala Tests on CircleCI

on:
push:
branches:
- stage
workflow_dispatch:

jobs:
trigger-circleci:
Expand All @@ -15,4 +13,4 @@ jobs:
curl -X POST 'https://circle.ci.adobe.com/api/v2/project/gh/wcms/nala/pipeline' \
-H 'Circle-Token: ${{ secrets.CCI_TOKEN }}' \
-H 'content-type: application/json' \
-d "{\"branch\":\"main\"}"
-d "{\"branch\":\"main\"}"
4 changes: 2 additions & 2 deletions .github/workflows/update-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ Resolves: NO TICKET - AUTOMATED CREATED PR.
- After: https://main--blog--adobecom.hlx.page/?martech=off&milolibs=${branch}--milo--adobecom
**Milo:**
- Before: https://main--milo--adobecom.hlx.page/ch_de/drafts/ramuntea/gnav-refactor?martech=off
- After: https://${branch}--milo--adobecom.hlx.page/ch_de/drafts/ramuntea/gnav-refactor?martech=off`;
- Before: https://main--milo--adobecom.aem.page/ch_de/drafts/ramuntea/gnav-refactor?martech=off
- After: https://${branch}--milo--adobecom.aem.page/ch_de/drafts/ramuntea/gnav-refactor?martech=off`;

const fetchScript = (path) =>
new Promise((resolve, reject) => {
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,4 @@ logs/*
test-html-results/
test-results/
test-a11y-results/
libs/navigation/dist/
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Ensure that your PR follows the [pull request template](.github/pull_request_tem

* description contains Issue or Ticket
* description _always_ contains at least one Milo-specific testing URL
* `https://<branch>--milo--<user>.hlx.page/?martech=off`
* `https://<branch>--milo--<user>.aem.page/?martech=off`

Ensure your PR passes all checks:

Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Milo is a shared set of features and services to power Franklin-based websites o
[![codecov](https://codecov.io/gh/adobecom/milo/branch/main/graph/badge.svg?token=a7ZTCbitBt)](https://codecov.io/gh/adobecom/milo)

## Environments
[Preview](https://main--milo--adobecom.hlx.page) | [Live](https://milo.adobe.com)
[Preview](https://main--milo--adobecom.aem.page) | [Live](https://milo.adobe.com)

## Getting started

Expand Down Expand Up @@ -51,11 +51,11 @@ You can then test any of the following:
```
http://localhost:3000/?milolibs=local (local code, stage content)
https://main--project--owner.hlx.page/?milolibs=local (prod code, stage content)
https://main--project--owner.aem.page/?milolibs=local (prod code, stage content)
https://main--project--owner.hlx.live/?milolibs=local (prod code, prod content)
https://main--project--owner.aem.live/?milolibs=local (prod code, prod content)
https://feat-branch--project--owner.hlx.page/?milolibs=local (feature code, stage content)
https://feat-branch--project--owner.aem.page/?milolibs=local (feature code, stage content)
```

## Testing
Expand Down
2 changes: 1 addition & 1 deletion codecov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ coverage:
status:
patch:
default:
target: 100%
target: 90%
threshold: 0.1%
project:
default:
Expand Down
26 changes: 25 additions & 1 deletion helix-query.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: 1
# See https://www.hlx.live/docs/setup-indexing.
# See https://www.aem.live/docs/setup-indexing.

indices:
wiki:
Expand Down Expand Up @@ -60,18 +60,42 @@ indices:
- '/blog/drafts/**'
target: /blog/query-index.xlsx
properties:
author:
select: head > meta[name="author"]
value: |
attribute(el, 'content')
title:
select: head > meta[property="og:title"]
value: |
attribute(el, 'content')
date:
select: head > meta[name="publication-date"]
value: |
dateValue(attribute(el, 'content'), 'MM-DD-YYYY')
image:
select: head > meta[property="og:image"]
value: |
match(attribute(el, 'content'), 'https:\/\/[^/]+(\/.*)')
imageAlt:
select: head > meta[property="og:image:alt"]
value: |
attribute(el, 'content')
description:
select: head > meta[name="description"]
value: |
attribute(el, 'content')
tags:
select: head > meta[property="article:tag"]
values: |
attribute(el, 'content')
category:
select: head > meta[property="category"]
values: |
attribute(el, 'content')
robots:
select: head > meta[name="robots"]
value: |
attribute(el, 'content')
lastModified:
select: none
value: |
Expand Down
1 change: 1 addition & 0 deletions libs/blocks/adobetv/adobetv.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@import url('../../styles/iframe.css');
@import url('../video/video.css');

a[href*='.mp4'].hide-video {
visibility: hidden !important;
Expand Down
2 changes: 1 addition & 1 deletion libs/blocks/article-feed/article-feed.js
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ async function buildFilter(type, tax, block, config) {
dropdown.setAttribute('aria-labelledby', `${type}-filter-button`);
dropdown.setAttribute('role', 'menu');

const SEARCH_ICON = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" focusable="false">
const SEARCH_ICON = `<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" focusable="false">
<path d="M14 2A8 8 0 0 0 7.4 14.5L2.4 19.4a1.5 1.5 0 0 0 2.1 2.1L9.5 16.6A8 8 0 1 0 14 2Zm0 14.1A6.1 6.1 0 1 1 20.1 10 6.1 6.1 0 0 1 14 16.1Z"></path>
</svg>`;
const searchBar = createTag('div', { class: 'filter-search' });
Expand Down
Loading

0 comments on commit 163e0d2

Please sign in to comment.