From 5525b7494f96c7875805e9bbdc973c2c6f1355ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andony=20Nu=C3=B1ez?= Date: Tue, 14 Nov 2023 12:34:50 -0600 Subject: [PATCH] Update packages only once per PR --- .github/workflows/on-merge-to-main.yml | 2 +- .github/workflows/on-pullrequest.yml | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/on-merge-to-main.yml b/.github/workflows/on-merge-to-main.yml index 71dff5a2..e45ea2c2 100644 --- a/.github/workflows/on-merge-to-main.yml +++ b/.github/workflows/on-merge-to-main.yml @@ -20,7 +20,6 @@ jobs: runs-on: ubuntu-latest defaults: run: - shell: pwsh working-directory: Meadowlark-js steps: - name: Checkout the Repo @@ -33,6 +32,7 @@ jobs: echo "version=$version" >> "$GITHUB_OUTPUT" - name: Create Meadowlark Pre-Release + shell: pwsh run: | $version="${{steps.set-version.outputs.version}}" diff --git a/.github/workflows/on-pullrequest.yml b/.github/workflows/on-pullrequest.yml index 1b53a9b5..3688cd27 100644 --- a/.github/workflows/on-pullrequest.yml +++ b/.github/workflows/on-pullrequest.yml @@ -126,18 +126,26 @@ jobs: - name: Checkout the Repo uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c # v3.3.0 with: + fetch-depth: 0w ref: ${{ github.event.pull_request.head.ref }} + - name: Get changes + id: changes + run: echo "changes=$(git diff --name-only -r origin/main HEAD -- '*lerna.json')" >>$GITHUB_OUTPUT + - name: Update versions + if: ${{ ! steps.changes.outputs.changes }} run: npx lerna@6.6.2 version prerelease --exact --no-git-tag-version --yes - name: Set Version + if: ${{ ! steps.changes.outputs.changes }} id: set-version run: | version=v$(cat lerna.json | jq -r .version) echo "version=$version" >> "$GITHUB_OUTPUT" - uses: planetscale/ghcommit-action@v0.1.18 + if: ${{ ! steps.changes.outputs.changes }} with: commit_message: "${{steps.set-version.outputs.version}}" repo: ${{ github.repository }}