diff --git a/.github/actions/validate-solidity-artifacts/action.yaml b/.github/actions/validate-solidity-artifacts/action.yaml index fc5f4d5bbe4..b802661bc13 100644 --- a/.github/actions/validate-solidity-artifacts/action.yaml +++ b/.github/actions/validate-solidity-artifacts/action.yaml @@ -26,8 +26,17 @@ runs: steps: - name: Fetch base ref if: ${{ inputs.base_ref != '' }} + id: fetch_base_ref shell: bash - run: git fetch origin ${{ inputs.base_ref }} + run: | + if git cat-file -t "${{ inputs.base_ref }}" 2>/dev/null | grep -q commit; then + # we do not know to which branch the base ref belongs, so we fetch all branches + git fetch --all --prune + echo "ref_to_use=${{ inputs.base_ref }}" >> $GITHUB_OUTPUT + else + git fetch origin ${{ inputs.base_ref }} + echo "ref_to_use=origin/${{ inputs.base_ref }}" >> $GITHUB_OUTPUT + fi - name: Transform input array id: transform_input_array shell: bash @@ -72,13 +81,13 @@ runs: if: ${{ inputs.validate_uml_diagrams == 'true' }} shell: bash run: | - echo "Validating UML diagrams" + echo "Validating UML diagrams" IFS=',' read -r -a modified_files <<< "${{ steps.transform_input_array.outputs.sol_files }}" - missing_svgs=() + missing_svgs=() for file in "${modified_files[@]}"; do if [ "${{ inputs.base_ref }}" != "" ]; then # TODO remove this check when AurorNZ/paths-filter is fixed - status=$(git diff --name-status origin/${{ inputs.base_ref }} HEAD -- "$file" | awk '{ print $1 }') + status=$(git diff --name-status "${{ steps.fetch_base_ref.outputs.ref_to_use }}" HEAD -- "$file" | awk '{ print $1 }') if [ "$status" == "D" ]; then echo "File $file was deleted, skipping validation" continue @@ -114,7 +123,7 @@ runs: for file in "${modified_files[@]}"; do if [ "${{ inputs.base_ref }}" != "" ]; then # TODO remove this check when AurorNZ/paths-filter is fixed - status=$(git diff --name-status origin/${{ inputs.base_ref }} HEAD -- "$file" | awk '{ print $1 }') + status=$(git diff --name-status "${{ steps.fetch_base_ref.outputs.ref_to_use }}" HEAD -- "$file" | awk '{ print $1 }') if [ "$status" == "D" ]; then echo "File $file was deleted, skipping validation" continue diff --git a/.github/workflows/solidity-foundry-artifacts.yml b/.github/workflows/solidity-foundry-artifacts.yml index efd751bad57..66976d51e11 100644 --- a/.github/workflows/solidity-foundry-artifacts.yml +++ b/.github/workflows/solidity-foundry-artifacts.yml @@ -140,7 +140,7 @@ jobs: gather-basic-info: name: Gather basic info - if: ${{ steps.changes.outputs.product == 'true' || steps.changes.outputs.shared == 'true' }} + if: ${{ needs.changes.outputs.product_changes == 'true' || needs.changes.outputs.shared_changes == 'true' }} runs-on: ubuntu-22.04 needs: [ changes ] steps: diff --git a/.github/workflows/solidity-hardhat.yml b/.github/workflows/solidity-hardhat.yml index 2523a1949fb..cdc9b1e016d 100644 --- a/.github/workflows/solidity-hardhat.yml +++ b/.github/workflows/solidity-hardhat.yml @@ -6,7 +6,7 @@ env: FOUNDRY_PROFILE: ci # Has to match the `make foundry` version. FOUNDRY_VERSION: nightly-de33b6af53005037b463318d2628b5cfcaf39916 - base_ref: "f5e0bd614a6c42d195c4ad74a10f7070970d01d5" + base_ref: "1b4cb83bae78c398ad8ae6e47dbbe747ff93133e" product: "keystone" jobs: @@ -47,7 +47,7 @@ jobs: - 'contracts/src/v0.8/**/*.sol' - *ignored product: &product - - 'contracts/src/v0.8/${{ env.product }}/**/*.sol' + - 'contracts/src/v0.8/${{ env.product }}/**/*.sol' - *ignored included: - *product @@ -422,5 +422,7 @@ jobs: echo "Base Ref used: **${{ env.base_ref }}**" >> $GITHUB_STEP_SUMMARY echo "Commit SHA used: **${{ github.sha }}**" >> $GITHUB_STEP_SUMMARY echo "## Reason: No modified Solidity files found for ${{ env.product }}" >> $GITHUB_STEP_SUMMARY - echo "No modified Solidity files found between ${{ env.base_ref }} and ${{ github.sha }} commits or they are located outside of ./contracts/src/v0.8 folder" >> $GITHUB_STEP_SUMMARY + echo "* no modified Solidity files found between ${{ env.base_ref }} and ${{ github.sha }} commits" >> $GITHUB_STEP_SUMMARY + echo "* or they are located outside of `./contracts/src/v0.8` folder" >> $GITHUB_STEP_SUMMARY + echo "* or they were limited to test files" >> $GITHUB_STEP_SUMMARY exit 1