diff --git a/.github/actions/detect-solidity-foundry-version/action.yml b/.github/actions/detect-solidity-foundry-version/action.yml new file mode 100644 index 00000000000..ef378902f05 --- /dev/null +++ b/.github/actions/detect-solidity-foundry-version/action.yml @@ -0,0 +1,26 @@ +name: 'Detect Foundry version in GNUmakefile' +description: 'Detects Foundry version in GNUmakefile' +inputs: + working-directory: + description: 'The GNUmakefile directory' + required: false + default: 'contracts' +outputs: + foundry-version: + description: 'Foundry version found in GNUmakefile' + value: ${{ steps.extract-foundry-version.outputs.foundry-version }} +runs: + using: 'composite' + steps: + - name: Extract Foundry version + id: extract-foundry-version + shell: bash + working-directory: ${{ inputs.working-directory }} + run: | + foundry_version=$(grep -Eo "foundryup --version [^ ]+" GNUmakefile | awk '{print $3}') + if [ -z "$foundry_version" ]; then + echo "::error::Foundry version not found in GNUmakefile" + exit 1 + fi + echo "Foundry version found: $foundry_version" + echo "foundry-version=$foundry_version" >> $GITHUB_OUTPUT diff --git a/.github/workflows/solidity-foundry-artifacts.yml b/.github/workflows/solidity-foundry-artifacts.yml index a6da89d4712..e489033d675 100644 --- a/.github/workflows/solidity-foundry-artifacts.yml +++ b/.github/workflows/solidity-foundry-artifacts.yml @@ -110,7 +110,7 @@ jobs: runs-on: ubuntu-22.04 needs: [ changes ] outputs: - foundry_version: ${{ steps.extract-foundry-version.outputs.foundry_version }} + foundry_version: ${{ steps.extract-foundry-version.outputs.foundry-version }} steps: - name: Checkout the repo uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 @@ -118,17 +118,9 @@ jobs: fetch-depth: 0 - name: Extract Foundry version - id: extract-foundry-version - shell: bash - working-directory: contracts - run: | - foundry_version=$(grep -Eo "foundryup --version [^ ]+" GNUmakefile | awk '{print $3}') - if [ -z "$foundry_version" ]; then - echo "Error: Foundry version not found in GNUmakefile" - exit 1 - fi - echo "Foundry version found: $foundry_version" - echo "foundry_version=$foundry_version" >> $GITHUB_OUTPUT + uses: ./.github/actions/detect-solidity-foundry-version + with: + working-directory: contracts - name: Copy modified changesets if: ${{ needs.changes.outputs.changeset_changes == 'true' }} @@ -149,14 +141,7 @@ jobs: IFS=',' read -r -a modified_files <<< "${{ needs.changes.outputs.product_files }}" echo "# Modified contracts:" > contracts/modified_contracts.md - for file in "${modified_files[@]}"; do - # TODO remove this check when AurorNZ/paths-filter is fixed - status=$(git diff --name-status ${{ inputs.base_ref }} ${{ github.sha }} -- "$file" | awk '{ print $1 }') - if [ "$status" == "D" ]; then - echo "File $file was deleted, skipping." - continue - fi - + for file in "${modified_files[@]}"; do echo " - [$file](${{ github.server_url }}/${{ github.repository }}/blob/${{ github.sha }}/$file)" >> contracts/modified_contracts.md echo "$file" >> contracts/modified_contracts.txt done diff --git a/.github/workflows/solidity-hardhat.yml b/.github/workflows/solidity-hardhat.yml index b8a1a622c13..4cb19b26749 100644 --- a/.github/workflows/solidity-hardhat.yml +++ b/.github/workflows/solidity-hardhat.yml @@ -93,7 +93,7 @@ jobs: runs-on: ubuntu-22.04 needs: [ changes ] outputs: - foundry_version: ${{ steps.extract-foundry-version.outputs.foundry_version }} + foundry_version: ${{ steps.extract-foundry-version.outputs.foundry-version }} steps: - name: Checkout the repo uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2 @@ -101,17 +101,10 @@ jobs: fetch-depth: 0 - name: Extract Foundry version + uses: ./.github/actions/detect-solidity-foundry-version id: extract-foundry-version - shell: bash - working-directory: contracts - run: | - foundry_version=$(grep -Eo "foundryupZ --version [^ ]+" GNUmakefile | awk '{print $3}') - if [ -z "$foundry_version" ]; then - echo "Error: Foundry version not found in GNUmakefile" - exit 1 - fi - echo "Foundry version found: $foundry_version" - echo "foundry_version=$foundry_version" >> $GITHUB_OUTPUT + with: + working-directory: contracts - name: Copy modified changesets if: ${{ needs.changes.outputs.changeset_changes == 'true' }}