refactor(build): Adapt ckERC20 build script to more curated data #58235
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Binding Checks | |
| on: | |
| pull_request: | |
| merge_group: | |
| workflow_dispatch: | |
| permissions: {} | |
| jobs: | |
| generate: | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| pull-requests: write | |
| steps: | |
| - name: Create GitHub App Token | |
| uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 # v3.1.1 | |
| id: app-token | |
| continue-on-error: true | |
| with: | |
| app-id: ${{ vars.PR_AUTOMATION_BOT_PUBLIC_APP_ID }} | |
| private-key: ${{ secrets.PR_AUTOMATION_BOT_PUBLIC_PRIVATE_KEY }} | |
| - name: Check if commits can be added | |
| id: check_can_add_commit | |
| run: | | |
| echo steps.app-token.outputs.token null $TOKEN_IS_NULL | |
| echo steps.app-token.outputs.token empty $TOKEN_IS_EMPTY | |
| echo "can_add_commit=$CAN_ADD_COMMIT" >> $GITHUB_OUTPUT | |
| env: | |
| TOKEN_IS_NULL: ${{ steps.app-token.outputs.token == null }} | |
| TOKEN_IS_EMPTY: ${{ steps.app-token.outputs.token == '' }} | |
| CAN_ADD_COMMIT: ${{ steps.app-token.outputs.token != '' && github.event_name == 'pull_request' }} | |
| - name: Checkout code | |
| if: steps.check_can_add_commit.outputs.can_add_commit == 'true' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| token: ${{ steps.app-token.outputs.token }} | |
| persist-credentials: false | |
| - name: Checkout code | |
| if: steps.check_can_add_commit.outputs.can_add_commit == 'false' | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1 | |
| id: changes | |
| with: | |
| filters: | | |
| src: | |
| - # Any new or changed canisters | |
| 'dfx.json' | |
| - # Any new or changed .did files | |
| '**/*.did' | |
| - # Scripts, GitHub actions that contain 'backend' in their path. | |
| '**/*backend*' | |
| - # The backend source code | |
| 'src/backend/**' | |
| - 'src/shared/**' | |
| - # Rust files such as Cargo.lock, Cargo.toml and rust-toolchain.toml | |
| '**/Cargo*' | |
| - '**/*rust*' | |
| - # Scripts that download external Candid files, with false positives. | |
| 'scripts/build.*.sh' | |
| - # Scripts that generate the declarations. | |
| 'scripts/generate.sh' | |
| - # Scripts that download the candid files. | |
| 'scripts/did.sh' | |
| - # This workflow | |
| '.github/workflows/binding-checks.yml' | |
| - name: Build oisy-backend WASM | |
| if: steps.changes.outputs.src == 'true' | |
| uses: ./.github/actions/oisy-backend | |
| with: | |
| network: local | |
| - name: Prepare | |
| if: steps.changes.outputs.src == 'true' | |
| uses: ./.github/actions/prepare | |
| - name: Install rust | |
| run: scripts/setup rust | |
| - name: Install dfx | |
| if: steps.changes.outputs.src == 'true' | |
| uses: dfinity/setup-dfx@e50c04f104ee4285ec010f10609483cf41e4d365 # main | |
| - name: Install other tools | |
| if: steps.changes.outputs.src == 'true' | |
| run: scripts/setup cargo-binstall candid-extractor didc | |
| - name: Generate bindings | |
| if: steps.changes.outputs.src == 'true' | |
| run: npm run generate | |
| - name: Check bindings | |
| id: check_changes | |
| if: steps.changes.outputs.src == 'true' | |
| run: | | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| echo "changes_detected=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "changes_detected=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Commit bindings | |
| if: steps.changes.outputs.src == 'true' && steps.check_can_add_commit.outputs.can_add_commit == 'true' && steps.check_changes.outputs.changes_detected == 'true' | |
| uses: ./.github/actions/add-and-commit | |
| with: | |
| message: '🤖 Apply bindings changes' | |
| token: ${{ steps.app-token.outputs.token }} | |
| - name: Provide diff | |
| if: steps.changes.outputs.src == 'true' && steps.check_can_add_commit.outputs.can_add_commit == 'false' && steps.check_changes.outputs.changes_detected == 'true' | |
| run: | | |
| echo "FIX: Please execute npm run generate" | |
| git diff | |
| exit 1 | |
| binding-checks-pass: | |
| needs: ['generate'] | |
| if: ${{ always() }} | |
| runs-on: ubuntu-24.04 | |
| permissions: | |
| contents: read | |
| steps: | |
| - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/needs_success | |
| with: | |
| needs: '${{ toJson(needs) }}' |