Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/trunk' into fix/subscription-blo…
Browse files Browse the repository at this point in the history
…ck-toggles
  • Loading branch information
kraftbj committed Mar 9, 2023
2 parents abf6326 + 394c1b8 commit 2058fe1
Show file tree
Hide file tree
Showing 613 changed files with 4,897 additions and 2,246 deletions.
3 changes: 0 additions & 3 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

# Plugins

# Other bits of the Codebase
/projects/plugins/jetpack/_inc/lib/debugger/ @kraftbj

# Functionality that is important to our partners
/projects/plugins/jetpack/class.jetpack-cli.php @automattic/jetpack-infinity
/tools/partner-provision.sh @automattic/jetpack-infinity
Expand Down
15 changes: 15 additions & 0 deletions .github/files/required-review.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
- jetpack-reach
- red
- yamato-backup-and-security
- '@CGastrell'
- '@ice9js'

# Jetpack Approvers review the Jetpack plugin and all packages, except for those with specific team ownership.
- name: Jetpack and packages
Expand All @@ -35,6 +37,7 @@
- '!projects/js-packages/svelte-data-sync-client/**'
- '!projects/packages/wp-js-data-sync/**'
- '!projects/packages/backup/**'
- '!projects/packages/forms/**'
- '!projects/packages/import/**'
- '!projects/packages/search/**'
- '!projects/packages/stats/**'
Expand Down Expand Up @@ -154,6 +157,18 @@
- jetpack-reach
- jetpack-approvers

# The Crowdsignal team reviews changes to the Forms package.
- name: Forms
paths:
- 'projects/packages/forms/**'
- '!projects/plugins/*/composer.lock'
- '!projects/plugins/*/composer.json'
- '!projects/plugins/*/changelog/*'
teams:
- '@CGastrell'
- '@ice9js'
- jetpack-approvers

# Jetpack Approvers review everything that hasn't been specifically assigned above.
# This needs to be last.
- name: Default to Jetpack Approvers
Expand Down
37 changes: 32 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fixed

Use correct emoji in Kitkat notifications
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ function formatSlackMessage( payload, channel, message ) {
*/
async function notifyKitKat( payload, octokit ) {
const {
issue: { number },
issue: { number, state },
repository,
} = payload;
const { owner, name: repo } = repository;
Expand All @@ -137,6 +137,12 @@ async function notifyKitKat( payload, octokit ) {
return;
}

// Only proceed if the issue is stil open.
if ( 'open' !== state ) {
debug( `notify-kitkat: Issue #${ number } is state '${ state }'. Aborting.` );
return;
}

// Check if Kitkat input was already requested for that issue.
const hasBeenRequested = await hasKitkatSignalLabel( octokit, ownerLogin, repo, number );
if ( hasBeenRequested ) {
Expand All @@ -150,7 +156,7 @@ async function notifyKitKat( payload, octokit ) {
debug(
`notify-kitkat: Found a [Pri] High label on issue #${ number }. Sending in Slack message.`
);
const message = `:bug_police: New High priority bug! Please take a moment to triage this bug.`;
const message = `:bug-police: New High priority bug! Please take a moment to triage this bug.`;
const slackMessageFormat = formatSlackMessage( payload, channel, message );
await sendSlackMessage( message, channel, slackToken, payload, slackMessageFormat );
}
Expand All @@ -161,7 +167,7 @@ async function notifyKitKat( payload, octokit ) {
debug(
`notify-kitkat: Found a [Pri] BLOCKER label on issue #${ number }. Sending in Slack message.`
);
const message = `:bug_police: New Blocker bug! Please take a moment to triage this bug.`;
const message = `:bug-police: New Blocker bug! Please take a moment to triage this bug.`;
const slackMessageFormat = formatSlackMessage( payload, channel, message );
await sendSlackMessage( message, channel, slackToken, payload, slackMessageFormat );
}
Expand Down
23 changes: 23 additions & 0 deletions projects/github-actions/required-review/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,12 @@ The requirements consist of an array of requirement objects. A requirement objec
* `paths` is an array of path patterns, or the string "unmatched". If an array, the reviewers
specified will be checked if any path in the array matches any path in the PR. If the string
"unmatched", the reviewers are checked if any file in the PR has not been matched yet.
* `consume` is a boolean, defaulting to false. If set, any paths that match this rule will be ignored
for all following rules.

This is intended for things like lockfiles or changelogs that you might want to allow everyone
to edit in any package in a monorepo, to avoid having to manually exclude these files in every
requirement for each different team owning some package.
* `teams` is an array of strings that are GitHub team slugs in the organization or repository. A
review is required from a member of any of these teams.

Expand Down Expand Up @@ -108,6 +114,23 @@ the "Docs" and "Front end" review requirements. If you wanted to avoid that, you
teams:
- documentation
# Everyone can update lockfiles, even if later rules might otherwise match.
- name: Lockfiles
paths:
- 'packages/*/composer.lock'
- '**.css'
consume: true
teams:
- everyone
# The "Some package" team must approve anything in `packages/some-package/`.
# Except for changes to `packages/some-package/composer.lock`, because the previous requirement consumed that path.
- name: Some package
paths:
- 'packages/some-package/**'
teams:
- some-package-team

# Any CSS and React .jsx files must be reviewed by a front-end developer AND by a designer,
# OR by a member of the maintenance team.
- name: Front end
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: added

Added `consume` option for requirements.
2 changes: 1 addition & 1 deletion projects/github-actions/required-review/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "required-review",
"version": "3.0.2",
"version": "3.1.0-alpha",
"description": "Check that a Pull Request has reviews from required teams.",
"main": "index.js",
"author": "Automattic",
Expand Down
8 changes: 5 additions & 3 deletions projects/github-actions/required-review/src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,17 +63,19 @@ async function main() {
reviewers.forEach( r => core.info( r ) );
core.endGroup();

const paths = await require( './paths.js' )();
let paths = await require( './paths.js' )();
core.startGroup( `PR affects ${ paths.length } file(s)` );
paths.forEach( p => core.info( p ) );
core.endGroup();

const matchedPaths = [];
let matchedPaths = [];
let ok = true;
for ( let i = 0; i < requirements.length; i++ ) {
const r = requirements[ i ];
core.startGroup( `Checking requirement "${ r.name }"...` );
if ( ! r.appliesToPaths( paths, matchedPaths ) ) {
let applies;
( { applies, matchedPaths, paths } = r.appliesToPaths( paths, matchedPaths ) );
if ( ! applies ) {
core.endGroup();
core.info( `Requirement "${ r.name }" does not apply to any files in this PR.` );
} else if ( await r.isSatisfied( reviewers ) ) {
Expand Down
28 changes: 22 additions & 6 deletions projects/github-actions/required-review/src/requirement.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ class Requirement {
* @param {object} config - Object config
* @param {string[]|string} config.paths - Paths this requirement applies to. Either an array of picomatch globs, or the string "unmatched".
* @param {Array} config.teams - Team reviews requirements.
* @param {boolean} config.consume - Whether matched paths should be ignored by later rules.
*/
constructor( config ) {
this.name = config.name || 'Unnamed requirement';
Expand Down Expand Up @@ -163,14 +164,19 @@ class Requirement {
}

this.reviewerFilter = buildReviewerFilter( config, { 'any-of': config.teams }, ' ' );
this.consume = !! config.consume;
}

// eslint-disable-next-line jsdoc/require-returns, jsdoc/require-returns-check -- Doesn't support documentation of object structure.
/**
* Test whether this requirement applies to the passed paths.
*
* @param {string[]} paths - Paths to test against.
* @param {string[]} matchedPaths - Paths that have already been matched. Will be modified if true is returned.
* @returns {boolean} Whether the requirement applies.
* @param {string[]} matchedPaths - Paths that have already been matched.
* @returns {object} _ Results object.
* @returns {boolean} _.applies Whether the requirement applies.
* @returns {string[]} _.matchedPaths New value for `matchedPaths`.
* @returns {string[]} _.paths New value for `paths`.
*/
appliesToPaths( paths, matchedPaths ) {
let matches;
Expand All @@ -183,14 +189,24 @@ class Requirement {
}
}

if ( matches.length !== 0 ) {
const ret = {
applies: matches.length !== 0,
matchedPaths,
paths,
};

if ( ret.applies ) {
core.info( 'Matches the following files:' );
matches.forEach( m => core.info( ` - ${ m }` ) );
matchedPaths.push( ...matches.filter( p => ! matchedPaths.includes( p ) ) );
matchedPaths.sort();
ret.matchedPaths = [ ...new Set( [ ...matchedPaths, ...matches ] ) ].sort();

if ( this.consume ) {
core.info( 'Consuming matched files!' );
ret.paths = ret.paths.filter( p => ! matches.includes( p ) );
}
}

return matches.length !== 0;
return ret;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion projects/github-actions/required-review/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ function addenv {
eval "$(
# Read defaults from action.yml
node -e 'console.log( JSON.stringify( require( "js-yaml" ).load( require( "fs" ).readFileSync( process.argv[1] ) ) ) );' "$BASE/projects/github-actions/required-review/action.yml" |
jq -r '.inputs | to_entries | .[] | select( .key != "token" and .value.default ) | [ "addenv INPUT_", ( .key | ascii_upcase | sub( " "; "_" ) ), " ", @sh "\(.value.default)" ] | join( "" )';
jq -r '.inputs | to_entries | .[] | select( .key != "token" and ( .value | has( "default" ) ) ) | [ "addenv INPUT_", ( .key | ascii_upcase | sub( " "; "_" ) ), " ", @sh "\(.value.default)" ] | join( "" )';
# Read values from .github/workflows/required-review.yml
node -e 'console.log( JSON.stringify( require( "js-yaml" ).load( require( "fs" ).readFileSync( process.argv[1] ) ) ) );' "$BASE/.github/workflows/required-review.yml" |
Expand Down
4 changes: 4 additions & 0 deletions projects/js-packages/analytics/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

### This is a list detailing changes for the Jetpack RNA Analytics package releases.

## 0.1.25 - 2023-03-08
### Changed
- Updated package dependencies. [#29289]

## 0.1.24 - 2023-02-20
### Changed
- Minor internal updates.
Expand Down

This file was deleted.

2 changes: 1 addition & 1 deletion projects/js-packages/analytics/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automattic/jetpack-analytics",
"version": "0.1.25-alpha",
"version": "0.1.25",
"description": "Jetpack Analytics Package",
"author": "Automattic",
"license": "GPL-2.0-or-later",
Expand Down
4 changes: 4 additions & 0 deletions projects/js-packages/api/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

### This is a list detailing changes for the Jetpack RNA Components package releases.

## 0.15.2 - 2023-03-08
### Changed
- Updated package dependencies. [#29216]

## 0.15.1 - 2023-02-20
### Changed
- Minor internal updates.
Expand Down
4 changes: 0 additions & 4 deletions projects/js-packages/api/changelog/renovate-jest-monorepo

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion projects/js-packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@automattic/jetpack-api",
"version": "0.15.2-alpha",
"version": "0.15.2",
"description": "Jetpack Api Package",
"author": "Automattic",
"license": "GPL-2.0-or-later",
Expand Down
Loading

0 comments on commit 2058fe1

Please sign in to comment.