Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MWPW-151561 [MILO][MEP] MEP button does not appear if Target is on but there are no pzn manifests #2441

Merged
merged 3 commits into from
Jun 11, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/code-compatibility.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- name: Checkout code
uses: actions/checkout@v4
uses: actions/checkout@v3

- name: Check for unsupported functions
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,19 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
config-file: ./.github/codeql/codeql-config.yml

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v3
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
Expand All @@ -59,6 +59,6 @@ jobs:
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
uses: github/codeql-action/analyze@v2
with:
category: "/language:${{matrix.language}}"
6 changes: 3 additions & 3 deletions .github/workflows/dispatch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
uses: actions/checkout@v3
- uses: dorny/paths-filter@v2
id: changes
with:
base: ${{ github.ref }}
Expand All @@ -23,7 +23,7 @@ jobs:
- 'libs/**'
- if: steps.changes.outputs.src == 'true'
name: Trigger DC Workflow
uses: actions/github-script@v7
uses: actions/github-script@v6
with:
github-token: ${{ secrets.DC_PAT }}
script: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/fg-sync-repos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
repositories: "milo-pink"

- name: Checkout Repo
uses: actions/checkout@v4
uses: actions/checkout@v2
with:
persist-credentials: false
ref: ${{ inputs.syncBranch }}
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/high-impact-alert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v4.1.4
with:
ref: ${{ github.event.pull_request.base.ref }}

- name: Send Slack message for high impact PRs
uses: actions/github-script@v7
uses: actions/github-script@v7.0.1
with:
script: |
const main = require('./.github/workflows/high-impact-alert.js')
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/label-zero-impact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v4.1.4

- name: Add the zero impact label
uses: actions/github-script@v7
uses: actions/github-script@v7.0.1
with:
script: |
const main = require('./.github/workflows/label-zero-impact.js')
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/merge-to-main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ jobs:
if: github.repository_owner == 'adobecom' && (github.event_name == 'workflow_dispatch' || github.event_name == 'schedule' || (github.event_name == 'pull_request' && github.event.pull_request.base.ref == 'main' && github.event.pull_request.head.ref == 'stage'))

steps:
- uses: actions/create-github-app-token@v1
- uses: actions/create-github-app-token@v1.10.0
id: milo-pr-merge-token
with:
app-id: ${{ secrets.MILO_PR_MERGE_APP_ID }}
private-key: ${{ secrets.MILO_PR_MERGE_PRIVATE_KEY }}

- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v4.1.4

- name: Merge to main
uses: actions/github-script@v7
uses: actions/github-script@v7.0.1
with:
github-token: ${{ steps.milo-pr-merge-token.outputs.token }}
script: |
Expand Down
40 changes: 10 additions & 30 deletions .github/workflows/merge-to-stage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const {

Check warning on line 1 in .github/workflows/merge-to-stage.js

View workflow job for this annotation

GitHub Actions / Running eslint

[eslint] reported by reviewdog 🐶 File ignored by default. Use a negated ignore pattern (like "--ignore-pattern '!<relative/path/to/filename>'") to override. Raw Output: {"fatal":false,"severity":1,"message":"File ignored by default. Use a negated ignore pattern (like \"--ignore-pattern '!<relative/path/to/filename>'\") to override."}
slackNotification,
getLocalConfigs,
isWithinRCP,
Expand All @@ -15,7 +15,6 @@
highPriority: 'high priority',
readyForStage: 'Ready for Stage',
SOTPrefix: 'SOT',
zeroImpact: 'zero-impact',
};
const TEAM_MENTIONS = [
'@adobecom/miq-sot',
Expand All @@ -25,8 +24,8 @@
'@adobecom/document-cloud-sot',
];
const SLACK = {
merge: ({ html_url, number, title, prefix = '' }) =>
`:merged: PR merged to stage: ${prefix} <${html_url}|${number}: ${title}>.`,
merge: ({ html_url, number, title }) =>
`:merged: PR merged to stage: <${html_url}|${number}: ${title}>.`,
openedSyncPr: ({ html_url, number }) =>
`:fast_forward: Created <${html_url}|Stage to Main PR ${number}>`,
};
Expand All @@ -47,7 +46,6 @@
`;

const isHighPrio = (labels) => labels.includes(LABELS.highPriority);
const isZeroImpact = (labels) => labels.includes(LABELS.zeroImpact);

const hasFailingChecks = (checks) =>
checks.some(
Expand Down Expand Up @@ -82,34 +80,19 @@
return true;
});

return prs.reverse().reduce(
(categorizedPRs, pr) => {
if (isZeroImpact(pr.labels)) {
categorizedPRs.zeroImpactPRs.push(pr);
} else if (isHighPrio(pr.labels)) {
categorizedPRs.highImpactPRs.push(pr);
} else {
categorizedPRs.normalPRs.push(pr);
}
return categorizedPRs;
},
{ zeroImpactPRs: [], highImpactPRs: [], normalPRs: [] }
);
return prs.reverse(); // OLD PRs first
};

const merge = async ({ prs, type }) => {
console.log(`Merging ${prs.length || 0} ${type} PRs that are ready... `);
const merge = async ({ prs }) => {
console.log(`Merging ${prs.length || 0} PRs that are ready... `);

for await (const { number, files, html_url, title } of prs) {
try {
if (files.some((file) => SEEN[file])) {
console.log(`Skipping ${number}: ${title} due to overlap in files.`);
continue;
}
if (type !== LABELS.zeroImpact) {
files.forEach((file) => (SEEN[file] = true));
}

files.forEach((file) => (SEEN[file] = true));
if (!process.env.LOCAL_RUN) {
await github.rest.pulls.merge({
owner,
Expand All @@ -118,14 +101,12 @@
merge_method: 'squash',
});
}
const prefix = type === LABELS.zeroImpact ? ' [ZERO IMPACT]' : '';
body = `-${prefix} ${html_url}\n${body}`;
body = `- ${html_url}\n${body}`;
await slackNotification(
SLACK.merge({
html_url,
number,
title,
prefix,
})
);
await new Promise((resolve) => setTimeout(resolve, 5000));
Expand Down Expand Up @@ -204,12 +185,11 @@
const stageToMainPR = await getStageToMainPR();
console.log('has Stage to Main PR:', !!stageToMainPR);
if (stageToMainPR) body = stageToMainPR.body;
const { zeroImpactPRs, highImpactPRs, normalPRs } = await getPRs();
await merge({ prs: zeroImpactPRs, type: LABELS.zeroImpact });
if (stageToMainPR?.labels.some((label) => label.includes(LABELS.SOTPrefix)))
return console.log('PR exists & testing started. Stopping execution.');
await merge({ prs: highImpactPRs, type: LABELS.highPriority });
await merge({ prs: normalPRs, type: 'normal' });
const prs = await getPRs();
await merge({ prs: prs.filter(({ labels }) => isHighPrio(labels)) });
await merge({ prs: prs.filter(({ labels }) => !isHighPrio(labels)) });
if (!stageToMainPR) await openStageToMainPR();
if (stageToMainPR && body !== stageToMainPR.body) {
console.log("Updating PR's body...");
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/merge-to-stage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ jobs:
environment: milo_pr_merge

steps:
- uses: actions/create-github-app-token@v1
- uses: actions/create-github-app-token@v1.10.0
id: milo-pr-merge-token
with:
app-id: ${{ secrets.MILO_PR_MERGE_APP_ID }}
private-key: ${{ secrets.MILO_PR_MERGE_PRIVATE_KEY }}

- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v4.1.4

- name: Merge to stage or queue to merge
uses: actions/github-script@v7
uses: actions/github-script@v7.0.1
with:
github-token: ${{ steps.milo-pr-merge-token.outputs.token }}
script: |
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pr-reminders.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v4.1.1

- name: Remind PR initiators
uses: actions/github-script@v7
uses: actions/github-script@v7.0.1
with:
script: |
const main = require('./.github/workflows/pr-reminders.js')
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/run-lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
name: Running eslint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v2

- uses: actions/setup-node@v4
- uses: actions/setup-node@v2
with:
node-version: 20
node-version: 18

- name: Install dependencies
run: npm ci
Expand Down
108 changes: 54 additions & 54 deletions .github/workflows/run-nala-milolibs.yaml
Original file line number Diff line number Diff line change
@@ -1,54 +1,54 @@
name: Run Nala on Milo Libs

on:
workflow_dispatch:
inputs:
branch:
description: 'Provide the live branch url. ex: https://main--cc--adobecom.hlx.live'
required: false
type: string
milolibs:
description: 'Provide MiloLibs param. ex: ?milolibs=marquee-static-hover'
required: false
type: string
tags:
description: 'Test scenario tags, if empty all tests will run. i.e., @marquee'
required: false
type: string
platform:
description: 'Platform to run tests on; select one, options: [ubuntu-latest, macos-latest]'
required: true
type: string

jobs:
action:
name: Running tests
runs-on: ${{ inputs.platform }}
env:
WORKFLOW_NAME: 'Milo Libs Run'
MILO_LIBS_RUN: 'true'

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set environment variables
run: |
echo "PR_BRANCH_MILOLIBS_LIVE_URL=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
echo "MILO_LIBS=${{ github.event.inputs.milolibs }}" >> $GITHUB_ENV

- name: Run Nala ${{ inputs.platform }}
uses: adobecom/nala@main
env:
labels: ${{ inputs.tags }}
IMS_EMAIL: ${{ secrets.IMS_EMAIL }}
IMS_PASS: ${{ secrets.IMS_PASS }}
HLX_TKN: ${{ secrets.HLX_TKN }}
SLACK_WH: ${{ secrets.SLACK_WH }}
- name: Persist JSON Artifact
uses: actions/upload-artifact@v3
if: always()
with:
name: nala-results
path: nala-results.json
retention-days: 30
name: Run Nala on Milo Libs
on:
workflow_dispatch:
inputs:
branch:
description: 'Provide the live branch url. ex: https://main--cc--adobecom.hlx.live'
required: false
type: string
milolibs:
description: 'Provide MiloLibs param. ex: ?milolibs=marquee-static-hover'
required: false
type: string
tags:
description: 'Test scenario tags, if empty all tests will run. i.e., @marquee'
required: false
type: string
platform:
description: 'Platform to run tests on; select one, options: [ubuntu-latest, macos-latest]'
required: true
type: string
jobs:
action:
name: Running tests
runs-on: ${{ inputs.platform }}
env:
WORKFLOW_NAME: 'Milo Libs Run'
MILO_LIBS_RUN: 'true'
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set environment variables
run: |
echo "PR_BRANCH_MILOLIBS_LIVE_URL=${{ github.event.inputs.branch }}" >> $GITHUB_ENV
echo "MILO_LIBS=${{ github.event.inputs.milolibs }}" >> $GITHUB_ENV
- name: Run Nala ${{ inputs.platform }}
uses: adobecom/nala@main
env:
labels: ${{ inputs.tags }}
IMS_EMAIL: ${{ secrets.IMS_EMAIL }}
IMS_PASS: ${{ secrets.IMS_PASS }}
HLX_TKN: ${{ secrets.HLX_TKN }}
SLACK_WH: ${{ secrets.SLACK_WH }}
- name: Persist JSON Artifact
uses: actions/upload-artifact@v3
if: always()
with:
name: nala-results
path: nala-results.json
retention-days: 30
2 changes: 1 addition & 1 deletion .github/workflows/run-nala.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:

steps:
- name: Check out repository
uses: actions/checkout@v4
uses: actions/checkout@v3
- name: Run Nala
uses: adobecom/nala@main # Change if doing dev work
env:
Expand Down
Loading
Loading