From 84bea869baae733be6c05f52fe965a83a781db50 Mon Sep 17 00:00:00 2001 From: Raisa Primerova <48605821+RayRedGoose@users.noreply.github.com> Date: Wed, 18 Dec 2024 10:51:00 -0700 Subject: [PATCH] fix: Fix issue with layer opacity presenting in json (#135) Fixed issue with `layer-opacity` listed in token json. Also `web` scope has been added to commits and PR name [category:Infrastructure] Co-authored-by: Raisa Primerova --- .github/workflows/release-web.yml | 2 +- scripts/utils/pull-request.ts | 2 +- scripts/utils/sync-base-config.ts | 2 +- scripts/utils/sync-brand-config.ts | 2 +- scripts/utils/sync-sys-config.ts | 9 ++++++--- 5 files changed, 10 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release-web.yml b/.github/workflows/release-web.yml index cd8e18a..393a3b1 100644 --- a/.github/workflows/release-web.yml +++ b/.github/workflows/release-web.yml @@ -18,7 +18,7 @@ jobs: # Only run if: # - The commit message does not contain `[skip release]` # - OR the workflow was manually triggered and has a `version` string - if: "(!contains(github.event.head_commit.message, '[skip release]') && (contains(github.event.head_commit.message, '(web)') || contains(github.event.head_commit.message, '(all)'))) || inputs.version" + if: "(!contains(github.event.head_commit.message, '[skip release]') && contains(github.event.head_commit.message, '(web)')) || inputs.version" runs-on: ubuntu-latest steps: diff --git a/scripts/utils/pull-request.ts b/scripts/utils/pull-request.ts index 07600bb..3569d4c 100644 --- a/scripts/utils/pull-request.ts +++ b/scripts/utils/pull-request.ts @@ -43,7 +43,7 @@ export async function createSyncPullRequest(baseBranch = canvasTokensRepoParams. base: baseBranch, head: canvasTokensRepoParams.syncBranch, maintainer_can_modify: true, - title: 'chore: Sync Tokens Studio config 🤖', + title: 'chore(web): Sync Tokens Studio config 🤖', body: getPullRequestTemplate(), }); } diff --git a/scripts/utils/sync-base-config.ts b/scripts/utils/sync-base-config.ts index b58ec18..9737768 100644 --- a/scripts/utils/sync-base-config.ts +++ b/scripts/utils/sync-base-config.ts @@ -54,7 +54,7 @@ export async function syncBaseConfig() { repo: canvasTokensRepoParams.repo, path: canvasTokensRepoParams.baseConfigPath, branch: canvasTokensRepoParams.syncBranch, - message: 'chore: Sync base tokens config', + message: 'chore(web): Sync base tokens config', // If this is a new file, there will be no existing sha to reference. sha: canvasTokensConfig ? canvasTokensConfig.sha : undefined, content: encodedConfig, diff --git a/scripts/utils/sync-brand-config.ts b/scripts/utils/sync-brand-config.ts index cd1bba7..c913017 100644 --- a/scripts/utils/sync-brand-config.ts +++ b/scripts/utils/sync-brand-config.ts @@ -54,7 +54,7 @@ export async function syncBrandConfig() { repo: canvasTokensRepoParams.repo, path: canvasTokensRepoParams.brandConfigPath, branch: canvasTokensRepoParams.syncBranch, - message: 'chore: Sync brand tokens config', + message: 'chore(web): Sync brand tokens config', // If this is a new file, there will be no existing sha to reference. sha: canvasTokensConfig ? canvasTokensConfig.sha : undefined, content: encodedConfig, diff --git a/scripts/utils/sync-sys-config.ts b/scripts/utils/sync-sys-config.ts index 3449fad..d4e1d08 100644 --- a/scripts/utils/sync-sys-config.ts +++ b/scripts/utils/sync-sys-config.ts @@ -34,9 +34,12 @@ function filterNonWebTokens(config: Record) { // If the key is in the non web tokens, iterate over its tokens if (key in nonWebTokens) { for (const token in tokenSet) { - const nonWebTokenSet = nonWebTokens[key as keyof typeof nonWebTokens]; + const nonWebTokenSet: string[] = nonWebTokens[key as keyof typeof nonWebTokens]; + if (!nonWebTokenSet.length) { + delete config[key]; + } // If the token is non web, delete it from the config object - if (!nonWebTokenSet.length || (nonWebTokenSet as string[]).includes(token)) { + if (nonWebTokenSet.includes(token)) { delete config[key][token as keyof typeof tokenSet]; } } @@ -96,7 +99,7 @@ export async function syncSystemConfig() { repo: canvasTokensRepoParams.repo, path: canvasTokensRepoParams.sysConfigPath, branch: canvasTokensRepoParams.syncBranch, - message: 'chore: Sync system tokens config', + message: 'chore(web): Sync system tokens config', // If this is a new file, there will be no existing sha to reference. sha: canvasSystemTokensConfig ? canvasSystemTokensConfig.sha : undefined, content: encodedConfig,