diff --git a/.github/workflows/compare-layouts.yml b/.github/workflows/compare-layouts.yml index efa64b11..3f2f5d02 100644 --- a/.github/workflows/compare-layouts.yml +++ b/.github/workflows/compare-layouts.yml @@ -50,9 +50,13 @@ jobs: || github.event.workflow_run.head_branch }} run: | - gh pr view --repo "${PR_TARGET_REPO}" "${PR_BRANCH}" \ - --json 'number' --jq '"number=\(.number)"' \ - >> "${GITHUB_OUTPUT}" + pr_number=$(gh pr view --repo "${PR_TARGET_REPO}" "${PR_BRANCH}" \ + --json 'number' --jq '.number') + if [ -z "$pr_number" ]; then + echo "Error: PR number not found for branch '${PR_BRANCH}' in repository '${PR_TARGET_REPO}'" >&2 + exit 1 + fi + echo "number=$pr_number" >> "${GITHUB_OUTPUT}" - name: Set message id: set-message env: @@ -117,7 +121,7 @@ jobs: key: ${{ needs.setup.outputs.cache-key }} - name: Add Foundry to PATH if: ${{ github.event.workflow_run.conclusion == 'success' }} - run: echo "${{ needs.setup.outputs.installation-dir }}" >> $GITHUB_PATH + run: echo "${{ needs.setup.outputs.installation-dir }}" >> "$GITHUB_PATH" - name: Fetch the deployed layouts if: ${{ github.event.workflow_run.conclusion == 'success' }} run: | @@ -163,7 +167,7 @@ jobs: run: unzip storage-layouts.zip - name: Set up Node.js if: ${{ github.event.workflow_run.conclusion == 'success' }} - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: node-version: '18' - name: Clear npm cache diff --git a/.github/workflows/forge-ci.yml b/.github/workflows/forge-ci.yml index 6d7d38ac..cd5c4930 100644 --- a/.github/workflows/forge-ci.yml +++ b/.github/workflows/forge-ci.yml @@ -37,7 +37,7 @@ jobs: path: ${{ needs.setup.outputs.installation-dir }} key: ${{ needs.setup.outputs.cache-key }} - name: Add Foundry to PATH - run: echo "${{ needs.setup.outputs.installation-dir }}" >> $GITHUB_PATH + run: echo "${{ needs.setup.outputs.installation-dir }}" >> "$GITHUB_PATH" - name: Checkout repository uses: actions/checkout@v4 with: @@ -64,7 +64,7 @@ jobs: path: ${{ needs.build.outputs.installation-dir }} key: ${{ needs.build.outputs.cache-key }} - name: Add Foundry to PATH - run: echo "${{ needs.build.outputs.installation-dir }}" >> $GITHUB_PATH + run: echo "${{ needs.build.outputs.installation-dir }}" >> "$GITHUB_PATH" - name: Checkout repository uses: actions/checkout@v4 - name: Restore build artifacts @@ -91,7 +91,7 @@ jobs: path: ${{ needs.build.outputs.installation-dir }} key: ${{ needs.build.outputs.cache-key }} - name: Add Foundry to PATH - run: echo "${{ needs.build.outputs.installation-dir }}" >> $GITHUB_PATH + run: echo "${{ needs.build.outputs.installation-dir }}" >> "$GITHUB_PATH" - name: Checkout repository uses: actions/checkout@v4 - name: Restore build artifacts @@ -116,7 +116,7 @@ jobs: path: ${{ needs.build.outputs.installation-dir }} key: ${{ needs.build.outputs.cache-key }} - name: Add Foundry to PATH - run: echo "${{ needs.build.outputs.installation-dir }}" >> $GITHUB_PATH + run: echo "${{ needs.build.outputs.installation-dir }}" >> "$GITHUB_PATH" - name: Checkout base branch or previous commit uses: actions/checkout@v4 with: @@ -163,7 +163,7 @@ jobs: - name: Copy back base branch layout file run: cp /tmp/ExocoreGateway.base.json ./ExocoreGateway.base.json - name: Zip storage layout files - run: zip storage-layouts.zip *.compiled.json ExocoreGateway.base.json + run: zip "storage-layouts.zip" "./*.compiled.json" "./ExocoreGateway.base.json" - name: Upload storage layout files as an artifact uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/status-comment.yml b/.github/workflows/status-comment.yml index 560bd78b..aae79c98 100644 --- a/.github/workflows/status-comment.yml +++ b/.github/workflows/status-comment.yml @@ -44,9 +44,13 @@ jobs: || github.event.workflow_run.head_branch }} run: | - gh pr view --repo "${PR_TARGET_REPO}" "${PR_BRANCH}" \ - --json 'number' --jq '"number=\(.number)"' \ - >> "${GITHUB_OUTPUT}" + pr_number=$(gh pr view --repo "${PR_TARGET_REPO}" "${PR_BRANCH}" \ + --json 'number' --jq '.number') + if [ -z "$pr_number" ]; then + echo "Error: PR number not found for branch '${PR_BRANCH}' in repository '${PR_TARGET_REPO}'" >&2 + exit 1 + fi + echo "number=$pr_number" >> "${GITHUB_OUTPUT}" # Construct the message - name: Set message id: set-message @@ -77,4 +81,4 @@ jobs: header: ${{ github.event.workflow_run.name }} hide_details: true number: ${{ steps.pr-context.outputs.number }} - message: ${{ steps.set-message.outputs.message }} \ No newline at end of file + message: ${{ steps.set-message.outputs.message }} diff --git a/script/compareLayouts.js b/script/compareLayouts.js index 9e0fab34..cc9595dc 100644 --- a/script/compareLayouts.js +++ b/script/compareLayouts.js @@ -1,5 +1,5 @@ const fs = require('fs'); -const { getStorageUpgradeReport } = require('@openzeppelin/upgrades-core/dist/storage'); +const { getStorageUpgradeReport } = require('@openzeppelin/upgrades-core'); // Mapping of deployed and compiled file names const fileMappings = [