From 771e4453b206cd1d44b39869f96a450e04b6eb0a Mon Sep 17 00:00:00 2001 From: Sai Kumar Battinoju Date: Thu, 1 Aug 2024 21:00:13 +0530 Subject: [PATCH 1/2] chore: fix workflows to use the appropraite commit for checkout --- .github/workflows/deploy-npm.yml | 1 + .github/workflows/deploy-sanity-suite.yml | 2 ++ .github/workflows/deploy.yml | 16 ++++++++++++++++ .github/workflows/publish-new-release.yml | 1 + ...urity-code-quality-and-bundle-size-checks.yml | 3 +++ .github/workflows/unit-tests-and-lint.yml | 1 + 6 files changed, 24 insertions(+) diff --git a/.github/workflows/deploy-npm.yml b/.github/workflows/deploy-npm.yml index ef7957983..6e4cc5b61 100644 --- a/.github/workflows/deploy-npm.yml +++ b/.github/workflows/deploy-npm.yml @@ -36,6 +36,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + ref: ${{ github.sha }} - name: Get new version number run: | diff --git a/.github/workflows/deploy-sanity-suite.yml b/.github/workflows/deploy-sanity-suite.yml index 596296335..e9935076a 100644 --- a/.github/workflows/deploy-sanity-suite.yml +++ b/.github/workflows/deploy-sanity-suite.yml @@ -59,6 +59,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + ref: ${{ github.sha }} - name: Configure deployment options id: deployment-options diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d6736cd29..1685e23aa 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -24,6 +24,9 @@ on: type: string required: false default: '' + use_pr_head_sha: + type: string + default: 'false' secrets: AWS_ACCOUNT_ID: required: true @@ -63,8 +66,21 @@ jobs: role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/${{ secrets.AWS_S3_SYNC_ROLE }} aws-region: us-east-1 + - name: Determine checkout SHA + id: getSHA + run: | + if ${{ inputs.use_pr_head_sha }} == 'true'; then + sha=$(echo ${{ github.event.pull_request.head.sha }}) + else + sha=$(echo ${{ github.sha }}) + fi + echo "Checkout SHA: $sha" + echo "SHA=$sha" >> $GITHUB_OUTPUT + - name: Checkout uses: actions/checkout@v4 + with: + ref: ${{ steps.getSHA.outputs.SHA }} - name: Get new version number run: | diff --git a/.github/workflows/publish-new-release.yml b/.github/workflows/publish-new-release.yml index f46fd4ad6..b48d2c705 100644 --- a/.github/workflows/publish-new-release.yml +++ b/.github/workflows/publish-new-release.yml @@ -40,6 +40,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + ref: ${{ github.sha }} # In order to make a commit, we need to initialize a user. # You may choose to write something less generic here if you want, it doesn't matter functionality wise. diff --git a/.github/workflows/security-code-quality-and-bundle-size-checks.yml b/.github/workflows/security-code-quality-and-bundle-size-checks.yml index 6af603bcb..272ba8472 100644 --- a/.github/workflows/security-code-quality-and-bundle-size-checks.yml +++ b/.github/workflows/security-code-quality-and-bundle-size-checks.yml @@ -15,6 +15,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 + with: + ref: ${{ github.event.pull_request.head.sha }} - name: Setup Node uses: actions/setup-node@v4 @@ -43,6 +45,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} - name: Setup Node uses: actions/setup-node@v4 diff --git a/.github/workflows/unit-tests-and-lint.yml b/.github/workflows/unit-tests-and-lint.yml index 468394af6..99c2c15f6 100644 --- a/.github/workflows/unit-tests-and-lint.yml +++ b/.github/workflows/unit-tests-and-lint.yml @@ -21,6 +21,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + ref: ${{ github.event.pull_request.head.sha }} - name: Setup Node uses: actions/setup-node@v4 From d405d65676e6ab4be87a5272ae5f800adcf00e50 Mon Sep 17 00:00:00 2001 From: Sai Kumar Battinoju Date: Thu, 1 Aug 2024 21:11:13 +0530 Subject: [PATCH 2/2] chore: fix version target to push changes at the end --- packages/analytics-js-common/project.json | 5 +++-- packages/analytics-js-cookies/project.json | 5 +++-- packages/analytics-js-integrations/project.json | 5 +++-- packages/analytics-js-plugins/project.json | 5 +++-- packages/analytics-js-service-worker/project.json | 5 +++-- packages/analytics-js/project.json | 5 +++-- packages/analytics-v1.1/project.json | 5 +++-- packages/loading-scripts/project.json | 5 +++-- packages/sanity-suite/project.json | 5 +++-- 9 files changed, 27 insertions(+), 18 deletions(-) diff --git a/packages/analytics-js-common/project.json b/packages/analytics-js-common/project.json index 831cd1dea..78bc19b1e 100644 --- a/packages/analytics-js-common/project.json +++ b/packages/analytics-js-common/project.json @@ -44,9 +44,10 @@ "executor": "@jscutlery/semver:version", "options": { "baseBranch": "main", - "preset": "conventional", + "preset": "conventionalcommits", "tagPrefix": "{projectName}@", - "trackDeps": true + "trackDeps": true, + "push": true } }, "github": { diff --git a/packages/analytics-js-cookies/project.json b/packages/analytics-js-cookies/project.json index f811b3a72..f961886de 100644 --- a/packages/analytics-js-cookies/project.json +++ b/packages/analytics-js-cookies/project.json @@ -44,9 +44,10 @@ "executor": "@jscutlery/semver:version", "options": { "baseBranch": "main", - "preset": "conventional", + "preset": "conventionalcommits", "tagPrefix": "{projectName}@", - "trackDeps": true + "trackDeps": true, + "push": true } }, "github": { diff --git a/packages/analytics-js-integrations/project.json b/packages/analytics-js-integrations/project.json index 4e20c794c..46a7266a2 100644 --- a/packages/analytics-js-integrations/project.json +++ b/packages/analytics-js-integrations/project.json @@ -44,9 +44,10 @@ "executor": "@jscutlery/semver:version", "options": { "baseBranch": "main", - "preset": "conventional", + "preset": "conventionalcommits", "tagPrefix": "{projectName}@", - "trackDeps": true + "trackDeps": true, + "push": true } }, "github": { diff --git a/packages/analytics-js-plugins/project.json b/packages/analytics-js-plugins/project.json index 747aa1e9c..271a3f29f 100644 --- a/packages/analytics-js-plugins/project.json +++ b/packages/analytics-js-plugins/project.json @@ -44,9 +44,10 @@ "executor": "@jscutlery/semver:version", "options": { "baseBranch": "main", - "preset": "conventional", + "preset": "conventionalcommits", "tagPrefix": "{projectName}@", - "trackDeps": true + "trackDeps": true, + "push": true } }, "github": { diff --git a/packages/analytics-js-service-worker/project.json b/packages/analytics-js-service-worker/project.json index f5bb0e5d9..92a259adc 100644 --- a/packages/analytics-js-service-worker/project.json +++ b/packages/analytics-js-service-worker/project.json @@ -44,9 +44,10 @@ "executor": "@jscutlery/semver:version", "options": { "baseBranch": "main", - "preset": "conventional", + "preset": "conventionalcommits", "tagPrefix": "{projectName}@", - "trackDeps": true + "trackDeps": true, + "push": true } }, "github": { diff --git a/packages/analytics-js/project.json b/packages/analytics-js/project.json index 6b1b42e15..dbf6763c4 100644 --- a/packages/analytics-js/project.json +++ b/packages/analytics-js/project.json @@ -52,9 +52,10 @@ "executor": "@jscutlery/semver:version", "options": { "baseBranch": "main", - "preset": "conventional", + "preset": "conventionalcommits", "tagPrefix": "{projectName}@", - "trackDeps": true + "trackDeps": true, + "push": true } }, "github": { diff --git a/packages/analytics-v1.1/project.json b/packages/analytics-v1.1/project.json index da5319545..69e90df56 100644 --- a/packages/analytics-v1.1/project.json +++ b/packages/analytics-v1.1/project.json @@ -52,9 +52,10 @@ "executor": "@jscutlery/semver:version", "options": { "baseBranch": "main", - "preset": "conventional", + "preset": "conventionalcommits", "tagPrefix": "{projectName}@", - "trackDeps": true + "trackDeps": true, + "push": true } }, "github": { diff --git a/packages/loading-scripts/project.json b/packages/loading-scripts/project.json index 8049d4def..3485a4a91 100644 --- a/packages/loading-scripts/project.json +++ b/packages/loading-scripts/project.json @@ -44,9 +44,10 @@ "executor": "@jscutlery/semver:version", "options": { "baseBranch": "main", - "preset": "conventional", + "preset": "conventionalcommits", "tagPrefix": "{projectName}@", - "trackDeps": true + "trackDeps": true, + "push": true } }, "github": { diff --git a/packages/sanity-suite/project.json b/packages/sanity-suite/project.json index 04f602e88..3a00ffb3d 100644 --- a/packages/sanity-suite/project.json +++ b/packages/sanity-suite/project.json @@ -44,9 +44,10 @@ "executor": "@jscutlery/semver:version", "options": { "baseBranch": "main", - "preset": "conventional", + "preset": "conventionalcommits", "tagPrefix": "{projectName}@", - "trackDeps": true + "trackDeps": true, + "push": true } } }