From 1378a356da9340112b787fd07e315e8faab8cd1d Mon Sep 17 00:00:00 2001 From: Marc Berger Date: Thu, 12 Dec 2024 17:03:56 -0800 Subject: [PATCH 1/2] fix(IYY-266): Updates existing Power BI embeds to work with new PowerBI embed --- .../src/Plugin/EmbedSource/PowerBI.php | 8 +++---- .../modules/custom/ys_embed/ys_embed.install | 22 +++++++++++++++++++ 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_embed/src/Plugin/EmbedSource/PowerBI.php b/web/profiles/custom/yalesites_profile/modules/custom/ys_embed/src/Plugin/EmbedSource/PowerBI.php index ca91c6399a..1a8fc6a4f3 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_embed/src/Plugin/EmbedSource/PowerBI.php +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_embed/src/Plugin/EmbedSource/PowerBI.php @@ -21,12 +21,12 @@ class PowerBI extends EmbedSourceBase implements EmbedSourceInterface { /** * {@inheritdoc} */ - protected static $pattern = '/^https:\/\/app.powerbi.com\/(?view|reportEmbed)(?\?.+)/'; + protected static $pattern = '/^https:\/\/app.powerbi.com\/(?view|reportEmbed)(?\?.+)/'; /** * {@inheritdoc} */ - protected static $template = ''; + protected static $template = ''; /** * {@inheritdoc} @@ -74,8 +74,8 @@ class PowerBI extends EmbedSourceBase implements EmbedSourceInterface { */ public function getUrl(array $params): string { $type = $params['type']; - $query_params = $params['query_params']; - return 'https://app.powerbi.com/' . $type . $query_params; + $form_params = $params['form_params']; + return 'https://app.powerbi.com/' . $type . $form_params; } } diff --git a/web/profiles/custom/yalesites_profile/modules/custom/ys_embed/ys_embed.install b/web/profiles/custom/yalesites_profile/modules/custom/ys_embed/ys_embed.install index c80aae3c68..45ebbe1d8d 100644 --- a/web/profiles/custom/yalesites_profile/modules/custom/ys_embed/ys_embed.install +++ b/web/profiles/custom/yalesites_profile/modules/custom/ys_embed/ys_embed.install @@ -179,3 +179,25 @@ function _copy_embed_file($filename) { return TRUE; } + +/** + * Updates existing Power BI embeds to add new type parameter. + */ +function ys_embed_update_9006() { + $media_storage = \Drupal::entityTypeManager()->getStorage('media'); + + $power_bi_embeds = $media_storage->loadByProperties([ + 'bundle' => 'embed', + 'field_media_embed.embed_source' => 'powerbi', + ]); + + foreach ($power_bi_embeds as $embed) { + /** @var \Drupal\media\Entity\Media $embed */ + $field_value = $embed->get('field_media_embed')->getValue(); + if (!isset($field_value[0]['params']['type'])) { + $field_value[0]['params']['type'] = 'view'; + $embed->set('field_media_embed', $field_value); + $embed->save(); + } + } +} From f6563c7b156b7e6213511c48847f954a56893367 Mon Sep 17 00:00:00 2001 From: Vincent Massaro Date: Fri, 13 Dec 2024 12:51:49 -0500 Subject: [PATCH 2/2] fix: prevent release.yml from running twice [skip ci] release.yml currently runs when a push is made to master, but should be changed to when a PR is merged, since semantic-release bumps the yalesites_profile version during the release with an additional commit, which is making the action run twice. --- .github/workflows/release.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 22a37aedea..42c2013659 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,13 +1,17 @@ name: Create a release on: - push: - branches: master + pull_request: + types: + - closed + branches: + - master env: GH_TOKEN: ${{ secrets.YALESITES_BUILD_TOKEN }} YALESITES_BUILD_TOKEN: ${{ secrets.YALESITES_BUILD_TOKEN }} jobs: build: runs-on: ubuntu-latest + if: github.event.pull_request.merged == true steps: - name: Checkout uses: actions/checkout@v4