From f721dfb2e44c107517673ba4713fefd8f31fccf8 Mon Sep 17 00:00:00 2001 From: Ben Siggery <14013357+siggerzz@users.noreply.github.com> Date: Mon, 18 Nov 2024 14:06:18 +0000 Subject: [PATCH] chore(pie-monorepo-utils): WCP-000 migrate GHA JS to package (#2070) * chore(pie-monorepo-utils): WCP-000 migrate GHA JS to package * added changeset --------- Co-authored-by: Ben Siggery --- .changeset/few-olives-poke.md | 6 ++++++ .github/workflows/changeset-snapshot.yml | 2 +- .github/workflows/labeler-get-labels.yml | 2 +- .github/workflows/labeler-set-labels.yml | 2 +- .github/workflows/test-aperture.yml | 2 +- .github/workflows/update-icons.yml | 2 +- package.json | 5 ++--- .../__snapshots__/create-and-publish.spec.js.snap | 0 .../changeset-snapshot}/create-and-publish.spec.js | 2 +- .../changeset-snapshot/create-and-publish.js | 0 .../pie-monorepo-utils}/changeset-snapshot/test-aperture.js | 0 .../create-icons-update-pr/create-icons-update-pr.js | 0 .../pr-labeler}/get-added-component-packages.js | 0 .../tools/pie-monorepo-utils/pr-labeler}/get-labels.js | 0 .../tools/pie-monorepo-utils/pr-labeler}/set-labels.js | 0 15 files changed, 14 insertions(+), 9 deletions(-) create mode 100644 .changeset/few-olives-poke.md rename {.github/workflows/changeset-snapshot/test => packages/tools/pie-monorepo-utils/__tests__/changeset-snapshot}/__snapshots__/create-and-publish.spec.js.snap (100%) rename {.github/workflows/changeset-snapshot/test => packages/tools/pie-monorepo-utils/__tests__/changeset-snapshot}/create-and-publish.spec.js (98%) rename {.github/workflows => packages/tools/pie-monorepo-utils}/changeset-snapshot/create-and-publish.js (100%) rename {.github/workflows => packages/tools/pie-monorepo-utils}/changeset-snapshot/test-aperture.js (100%) rename {.github/workflows => packages/tools/pie-monorepo-utils}/create-icons-update-pr/create-icons-update-pr.js (100%) rename {.github/workflows/labeler => packages/tools/pie-monorepo-utils/pr-labeler}/get-added-component-packages.js (100%) rename {.github/workflows/labeler => packages/tools/pie-monorepo-utils/pr-labeler}/get-labels.js (100%) rename {.github/workflows/labeler => packages/tools/pie-monorepo-utils/pr-labeler}/set-labels.js (100%) diff --git a/.changeset/few-olives-poke.md b/.changeset/few-olives-poke.md new file mode 100644 index 0000000000..50800ec415 --- /dev/null +++ b/.changeset/few-olives-poke.md @@ -0,0 +1,6 @@ +--- +"@justeattakeaway/pie-monorepo-utils": minor +"pie-monorepo": minor +--- + +[Added] - GitHub Actions JS to pie-monorepo-utils package diff --git a/.github/workflows/changeset-snapshot.yml b/.github/workflows/changeset-snapshot.yml index 7251653fc9..10cb0b37fa 100644 --- a/.github/workflows/changeset-snapshot.yml +++ b/.github/workflows/changeset-snapshot.yml @@ -140,7 +140,7 @@ jobs: github-token: ${{ secrets.CHANGESETS_TOKEN }} script: | const execa = require('execa'); - const script = require('./.github/workflows/changeset-snapshot/create-and-publish.js') + const script = require('./packages/tools/pie-monorepo-utils/changeset-snapshot/create-and-publish.js') await script({ github, context }, execa); - name: Add failure comment diff --git a/.github/workflows/labeler-get-labels.yml b/.github/workflows/labeler-get-labels.yml index e582c4d341..a8b55a2565 100644 --- a/.github/workflows/labeler-get-labels.yml +++ b/.github/workflows/labeler-get-labels.yml @@ -23,7 +23,7 @@ jobs: with: script: | const { PR_BRANCH_NAME, PR_NUMBER } = process.env; - const script = require('./.github/workflows/labeler/get-labels.js'); + const script = require('./packages/tools/pie-monorepo-utils/pr-labeler/get-labels.js'); const config = { prBranchName: PR_BRANCH_NAME, prNumber: PR_NUMBER, diff --git a/.github/workflows/labeler-set-labels.yml b/.github/workflows/labeler-set-labels.yml index 7104947005..77b1ca124b 100644 --- a/.github/workflows/labeler-set-labels.yml +++ b/.github/workflows/labeler-set-labels.yml @@ -21,5 +21,5 @@ jobs: with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | - const script = require('./.github/workflows/labeler/set-labels.js'); + const script = require('./packages/tools/pie-monorepo-utils/pr-labeler/set-labels.js'); await script({ github, context }); diff --git a/.github/workflows/test-aperture.yml b/.github/workflows/test-aperture.yml index 432c746e17..274ef0a4cc 100644 --- a/.github/workflows/test-aperture.yml +++ b/.github/workflows/test-aperture.yml @@ -148,7 +148,7 @@ jobs: github-token: ${{ secrets.CHANGESETS_TOKEN }} script: | const execa = require('execa'); - const script = require('./.github/workflows/changeset-snapshot/test-aperture.js') + const script = require('./packages/tools/pie-monorepo-utils/changeset-snapshot/test-aperture.js') await script({ github, context }, execa); - name: Add failure comment diff --git a/.github/workflows/update-icons.yml b/.github/workflows/update-icons.yml index 28f67fa20e..e26656d52d 100644 --- a/.github/workflows/update-icons.yml +++ b/.github/workflows/update-icons.yml @@ -32,7 +32,7 @@ jobs: CHANGESET_FILE_PATH: ${{ env.CHANGESET_FILE_PATH }} # this is set by the previous step with: script: | - const script = require('./.github/workflows/create-icons-update-pr/create-icons-update-pr.js'); + const script = require('./packages/tools/pie-monorepo-utils/create-icons-update-pr/create-icons-update-pr.js'); const { BRANCH_NAME, CHANGESET_FILE_PATH } = process.env const config = { github, diff --git a/package.json b/package.json index 0e86e7b06d..b7f0256b4c 100644 --- a/package.json +++ b/package.json @@ -43,10 +43,9 @@ "postinstall": "husky install", "prepack": "pinst --disable", "postpack": "pinst --enable", - "test": "yarn test:workflows && cross-env-shell turbo run test --filter=!pie-monorepo --token=${TURBO_TOKEN}", - "test:workflows": "cross-env-shell vitest run .github/workflows", + "test": "cross-env-shell turbo run test --filter=!pie-monorepo --token=${TURBO_TOKEN}", "test:watch": "cross-env-shell turbo run test:watch --filter=!pie-monorepo", - "test:ci": "yarn test:workflows && cross-env-shell turbo run test:ci --filter=!'./apps/examples/*' --filter=!pie-monorepo --token=${TURBO_TOKEN}", + "test:ci": "cross-env-shell turbo run test:ci --filter=!'./apps/examples/*' --filter=!pie-monorepo --token=${TURBO_TOKEN}", "test:coverage": "turbo run test:coverage --filter=!pie-monorepo", "test:generate-routes": "turbo run test:generate-routes --filter=!pie-monorepo --token=${TURBO_TOKEN}", "test:browsers-setup": "turbo run test:browsers-setup --filter=!pie-monorepo --token=${TURBO_TOKEN}", diff --git a/.github/workflows/changeset-snapshot/test/__snapshots__/create-and-publish.spec.js.snap b/packages/tools/pie-monorepo-utils/__tests__/changeset-snapshot/__snapshots__/create-and-publish.spec.js.snap similarity index 100% rename from .github/workflows/changeset-snapshot/test/__snapshots__/create-and-publish.spec.js.snap rename to packages/tools/pie-monorepo-utils/__tests__/changeset-snapshot/__snapshots__/create-and-publish.spec.js.snap diff --git a/.github/workflows/changeset-snapshot/test/create-and-publish.spec.js b/packages/tools/pie-monorepo-utils/__tests__/changeset-snapshot/create-and-publish.spec.js similarity index 98% rename from .github/workflows/changeset-snapshot/test/create-and-publish.spec.js rename to packages/tools/pie-monorepo-utils/__tests__/changeset-snapshot/create-and-publish.spec.js index b123209924..5c0b0041a1 100644 --- a/.github/workflows/changeset-snapshot/test/create-and-publish.spec.js +++ b/packages/tools/pie-monorepo-utils/__tests__/changeset-snapshot/create-and-publish.spec.js @@ -1,5 +1,5 @@ import { beforeEach, describe, expect, test, vi } from 'vitest'; -const workflow = require('../create-and-publish'); +const workflow = require('../../changeset-snapshot/create-and-publish'); const { Readable } = require('stream'); let context; diff --git a/.github/workflows/changeset-snapshot/create-and-publish.js b/packages/tools/pie-monorepo-utils/changeset-snapshot/create-and-publish.js similarity index 100% rename from .github/workflows/changeset-snapshot/create-and-publish.js rename to packages/tools/pie-monorepo-utils/changeset-snapshot/create-and-publish.js diff --git a/.github/workflows/changeset-snapshot/test-aperture.js b/packages/tools/pie-monorepo-utils/changeset-snapshot/test-aperture.js similarity index 100% rename from .github/workflows/changeset-snapshot/test-aperture.js rename to packages/tools/pie-monorepo-utils/changeset-snapshot/test-aperture.js diff --git a/.github/workflows/create-icons-update-pr/create-icons-update-pr.js b/packages/tools/pie-monorepo-utils/create-icons-update-pr/create-icons-update-pr.js similarity index 100% rename from .github/workflows/create-icons-update-pr/create-icons-update-pr.js rename to packages/tools/pie-monorepo-utils/create-icons-update-pr/create-icons-update-pr.js diff --git a/.github/workflows/labeler/get-added-component-packages.js b/packages/tools/pie-monorepo-utils/pr-labeler/get-added-component-packages.js similarity index 100% rename from .github/workflows/labeler/get-added-component-packages.js rename to packages/tools/pie-monorepo-utils/pr-labeler/get-added-component-packages.js diff --git a/.github/workflows/labeler/get-labels.js b/packages/tools/pie-monorepo-utils/pr-labeler/get-labels.js similarity index 100% rename from .github/workflows/labeler/get-labels.js rename to packages/tools/pie-monorepo-utils/pr-labeler/get-labels.js diff --git a/.github/workflows/labeler/set-labels.js b/packages/tools/pie-monorepo-utils/pr-labeler/set-labels.js similarity index 100% rename from .github/workflows/labeler/set-labels.js rename to packages/tools/pie-monorepo-utils/pr-labeler/set-labels.js