Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into infrastructure/872…
Browse files Browse the repository at this point in the history
…4-phpcs-updates.
  • Loading branch information
benbowler committed Jul 8, 2024
2 parents 9c3d558 + 905fa5b commit e5e7835
Show file tree
Hide file tree
Showing 126 changed files with 3,865 additions and 748 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ jobs:
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"

- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand All @@ -132,7 +132,7 @@ jobs:
run: npm run test:e2e

- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: e2e-screenshots
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/php-lint-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down Expand Up @@ -124,7 +124,7 @@ jobs:
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v3
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand Down
18 changes: 9 additions & 9 deletions .github/workflows/storybook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
run: |
npm run build:storybook
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: storybook-files
path: dist
Expand All @@ -84,25 +84,25 @@ jobs:
ref: gh-pages
token: ${{ secrets.GH_BOT_TOKEN }}
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: storybook-files
path: dist
- name: Set branch environment variables
id: branch-target
if: github.event_name != 'pull_request'
run: echo "dir=${GITHUB_REF##*/}" >> $GITHUB_OUTPUT
run: echo "dir=${GITHUB_REF##*/}" >> "$GITHUB_OUTPUT"
- name: Set PR environment variables
id: pr-target
if: github.event_name == 'pull_request'
env:
PULL_REQUEST_NUMBER: ${{ github.event.number }}
run: echo "dir=pull/${PULL_REQUEST_NUMBER}" >> $GITHUB_OUTPUT
run: echo "dir=pull/${PULL_REQUEST_NUMBER}" >> "$GITHUB_OUTPUT"
- name: Commit updates
run: |
mkdir -p storybook/${TARGET_DIR}
rm -rf storybook/${TARGET_DIR}
mv dist storybook/${TARGET_DIR}
mkdir -p "storybook/${TARGET_DIR}"
rm -rf "storybook/${TARGET_DIR}"
mv dist "storybook/${TARGET_DIR}"
git add .
git status
git diff --staged --quiet && echo 'No changes to commit; exiting!' && exit 0
Expand Down Expand Up @@ -134,7 +134,7 @@ jobs:
GIT_COMMITTER_EMAIL: google-site-kit-bot@google.com
GIT_COMMITTER_NAME: google-site-kit-bot
run: |
git rm -rf storybook/pull/${PULL_REQUEST_NUMBER}
git rm -rf "storybook/pull/${PULL_REQUEST_NUMBER}"
git status
git diff --staged --quiet && echo 'No changes to commit; exiting!' && exit 0
git pull --no-edit --quiet
Expand All @@ -150,7 +150,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Download artifacts
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: storybook-files
path: dist
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/visual-regression.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:
- name: Run Backstopjs
run: npm run test:visualtest
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure()
with:
name: vrt-report
Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/workflow-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- uses: reviewdog/action-actionlint@v1
env:
REVIEWDOG_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
# Neither inline shellcheck nor `actionlint_flags`
# disable a rule, so this must be disabled using
# an env variable.
SHELLCHECK_OPTS: "-e SC2129"
27 changes: 14 additions & 13 deletions .github/workflows/zips.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

name: Plugin Zip Files

on:
Expand Down Expand Up @@ -94,8 +95,8 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get Composer Cache Directory
id: composer-cache
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
run: echo "dir=$(composer config cache-files-dir)" >> "$GITHUB_OUTPUT"
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
Expand All @@ -113,18 +114,18 @@ jobs:
npm ci
- name: Create destination directory and update file permissions
run: |
mkdir -p ${{ github.ref }}
sudo chown -R $(id -u):$(id -g) .
mkdir -p "${{ github.ref }}"
sudo chown -R "$(id -u):$(id -g)" .
- name: Build develop version
run: |
npm run dev-zip
mv *.zip ${{ github.ref }}/google-site-kit-dev.zip
mv ./*.zip "${{ github.ref }}/google-site-kit-dev.zip"
- name: Build release version
run: |
npm run release-zip
mv *.zip ${{ github.ref }}/google-site-kit.zip
mv ./*.zip "${{ github.ref }}/google-site-kit.zip"
- name: Upload artifacts
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: zip-files
path: ${{ github.ref }}
Expand All @@ -135,15 +136,15 @@ jobs:
if: github.event_name != 'workflow_dispatch'
needs: build-zips
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: zip-files
path: ${{ github.ref }}
- uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.GCP_CREDENTIALS }}
- name: Upload PR files
uses: google-github-actions/upload-cloud-storage@v1
uses: google-github-actions/upload-cloud-storage@v2
with:
path: ${{ github.ref }}
destination: ${{ env.GCS_BUCKET }}/${{ env.GCS_ROOT_PATH }}/${{ github.ref }}
Expand Down Expand Up @@ -171,9 +172,9 @@ jobs:
- Download [development build](https://storage.googleapis.com/${{ env.GCS_BUCKET }}/${{ env.GCS_ROOT_PATH }}/${{ github.ref }}/google-site-kit-dev.zip?${{ github.sha }})
- Download [production build](https://storage.googleapis.com/${{ env.GCS_BUCKET }}/${{ env.GCS_ROOT_PATH }}/${{ github.ref }}/google-site-kit.zip?${{ github.sha }})"
delimiter="${body//$'\n'/'%0A'}"
echo "body<<${delimiter}" >> $GITHUB_OUTPUT
echo "$body" >> $GITHUB_OUTPUT
echo "${delimiter}" >> $GITHUB_OUTPUT
echo "body<<${delimiter}" >> "$GITHUB_OUTPUT"
echo "$body" >> "$GITHUB_OUTPUT"
echo "${delimiter}" >> "$GITHUB_OUTPUT"
- name: Create comment on PR with links to build files
if: ${{ steps.find-comment.outputs.comment-id == '' }}
uses: peter-evans/create-or-update-comment@v4
Expand Down Expand Up @@ -230,7 +231,7 @@ jobs:
needs: build-zips
timeout-minutes: 20
steps:
- uses: actions/download-artifact@v3
- uses: actions/download-artifact@v4
with:
name: zip-files
path: /tmp
Expand Down
29 changes: 21 additions & 8 deletions assets/js/components/ModalDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function ModalDialog( {
inProgress = false,
small = false,
medium = false,
buttonLink = null,
} ) {
const instanceID = useInstanceId( ModalDialog );
const describedByID = `googlesitekit-dialog-description-${ instanceID }`;
Expand Down Expand Up @@ -125,14 +126,25 @@ function ModalDialog( {
>
{ __( 'Cancel', 'google-site-kit' ) }
</Button>
<SpinnerButton
onClick={ handleConfirm }
danger={ danger }
disabled={ inProgress }
isSaving={ inProgress }
>
{ confirmButton || __( 'Disconnect', 'google-site-kit' ) }
</SpinnerButton>
{ buttonLink ? (
<Button
href={ buttonLink }
target="_blank"
danger={ danger }
>
{ confirmButton }
</Button>
) : (
<SpinnerButton
onClick={ handleConfirm }
danger={ danger }
disabled={ inProgress }
isSaving={ inProgress }
>
{ confirmButton ||
__( 'Disconnect', 'google-site-kit' ) }
</SpinnerButton>
) }
</DialogFooter>
</Dialog>
);
Expand All @@ -150,6 +162,7 @@ ModalDialog.propTypes = {
danger: PropTypes.bool,
small: PropTypes.bool,
medium: PropTypes.bool,
buttonLink: PropTypes.string,
};

export default ModalDialog;
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ function AuthenticatedPermissionsModal() {
// If we have a datastores to snapshot before navigating away to the
// authorization page, do that first.
await snapshotAllStores( registry );

// Navigate to the authorization page.
navigateTo( connectURL );
}, [ registry, connectURL, navigateTo, permissionsError, setValues ] );

Expand Down
6 changes: 6 additions & 0 deletions assets/js/components/notifications/ErrorNotifications.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,12 @@ export default function ErrorNotifications() {
}
}

if (
temporaryPersistedPermissionsError?.data?.skipDefaultErrorNotifications
) {
return null;
}

return (
<Fragment>
<InternalServerError />
Expand Down
16 changes: 15 additions & 1 deletion assets/js/components/notifications/SetupErrorNotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import { __ } from '@wordpress/i18n';
import { useSelect } from 'googlesitekit-data';
import BannerNotification from './BannerNotification';
import { CORE_SITE } from '../../googlesitekit/datastore/site/constants';
import { CORE_FORMS } from '../../googlesitekit/datastore/forms/constants';
import { FORM_TEMPORARY_PERSIST_PERMISSION_ERROR } from '../../googlesitekit/datastore/user/constants';

export default function SetupErrorNotification() {
// These will be `null` if no errors exist.
Expand All @@ -37,7 +39,19 @@ export default function SetupErrorNotification() {
select( CORE_SITE ).getSetupErrorRedoURL()
);

if ( ! setupErrorMessage ) {
const { data: permissionsErrorData } = useSelect(
( select ) =>
select( CORE_FORMS ).getValue(
FORM_TEMPORARY_PERSIST_PERMISSION_ERROR,
'permissionsError'
) || {}
);

// If there's no setup error message or the temporary persisted permissions error has skipDefaultErrorNotifications flag set, return null.
if (
! setupErrorMessage ||
permissionsErrorData?.skipDefaultErrorNotifications
) {
return null;
}

Expand Down
5 changes: 4 additions & 1 deletion assets/js/components/settings/SettingsActiveModule/Header.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { useSelect } from 'googlesitekit-data';
import { Button } from 'googlesitekit-components';
import { CORE_MODULES } from '../../../googlesitekit/modules/datastore/constants';
import { EXPERIMENTAL_MODULES } from '../../dashboard-sharing/DashboardSharingSettings/constants';
import { NEW_MODULES } from '../constants';
import { Grid, Row, Cell } from '../../../material-components';
import { useKeyCodesInside } from '../../../hooks/useKeyCodesInside';
import ModuleIcon from '../../ModuleIcon';
Expand Down Expand Up @@ -180,7 +181,9 @@ export default function Header( { slug } ) {
hasLeftSpacing
/>
) }
{ slug === 'ads' && <NewBadge hasLeftSpacing /> }
{ NEW_MODULES.includes( slug ) && (
<NewBadge hasLeftSpacing />
) }
</div>
</Cell>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ describe( 'SettingsModule', () => {
// Hack to avoid act error due to state change during render.
await act( () =>
registry
.__experimentalResolveSelect( CORE_MODULES )
.resolveSelect( CORE_MODULES )
.canActivateModule( 'tagmanager' )
);

Expand Down
5 changes: 4 additions & 1 deletion assets/js/components/settings/SetupModule.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import { CORE_SITE } from '../../googlesitekit/datastore/site/constants';
import { CORE_MODULES } from '../../googlesitekit/modules/datastore/constants';
import { CORE_LOCATION } from '../../googlesitekit/datastore/location/constants';
import { EXPERIMENTAL_MODULES } from '../dashboard-sharing/DashboardSharingSettings/constants';
import { NEW_MODULES } from './constants';
import { trackEvent } from '../../util';
import useViewContext from '../../hooks/useViewContext';

Expand Down Expand Up @@ -114,7 +115,9 @@ export default function SetupModule( { slug, name, description } ) {
label={ __( 'Experimental', 'google-site-kit' ) }
/>
) }
{ slug === 'ads' && <NewBadge hasNoSpacing /> }
{ NEW_MODULES.includes( slug ) && (
<NewBadge hasNoSpacing />
) }
</div>
</div>
<p className="googlesitekit-settings-connect-module__text">
Expand Down
19 changes: 19 additions & 0 deletions assets/js/components/settings/constants.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/**
* Settings constants.
*
* Site Kit by Google, Copyright 2024 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

export const NEW_MODULES = [ 'ads', 'reader-revenue-manager' ];
3 changes: 1 addition & 2 deletions assets/js/components/setup/ModuleSetup.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ export default function ModuleSetup( { moduleSlug } ) {
return;
}

const { select, __experimentalResolveSelect: resolveSelect } =
registry;
const { select, resolveSelect } = registry;
await resolveSelect( CORE_SITE ).getSiteInfo();
const adminURL = select( CORE_SITE ).getAdminURL(
'googlesitekit-dashboard',
Expand Down
Loading

0 comments on commit e5e7835

Please sign in to comment.