Make the TypeScript code depend on the publish argon2id-wasm package #44
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: Rust | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
| cancel-in-progress: true | |
| on: | |
| pull_request: | |
| paths: | |
| - "packages/argon2id-wasm/rust/**" | |
| - ".github/workflows/rust.yml" | |
| - ".github/actions/rust-setup/**" | |
| workflow_dispatch: | |
| permissions: {} | |
| jobs: | |
| ci: | |
| name: CI | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| defaults: | |
| run: | |
| working-directory: packages/argon2id-wasm/rust | |
| steps: | |
| - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 | |
| with: | |
| persist-credentials: false | |
| - uses: ./.github/actions/rust-setup | |
| - name: cargo fmt | |
| run: just fmt | |
| - name: cargo clippy | |
| run: just lint | |
| - name: cargo test | |
| run: just test | |
| - name: Compile for wasm32 target | |
| run: just check | |
| comment: | |
| name: Comment on PR | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1 | |
| with: | |
| script: | | |
| const marker = '<!-- rust-code-modified -->'; | |
| const body = [ | |
| marker, | |
| '⚠️ **This PR modifies the Rust code.**', | |
| '', | |
| 'For these changes to take effect in the TypeScript code, you will need to:', | |
| '', | |
| '1. Publish a new version of the `argon2id-wasm` package on npm.', | |
| '2. Update the dependency on `argon2id-wasm` in the `core` component.', | |
| ].join('\n'); | |
| const { data: comments } = await github.rest.issues.listComments({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| }); | |
| const existing = comments.find((c) => c.body.includes(marker)); | |
| if (existing) { | |
| await github.rest.issues.updateComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| comment_id: existing.id, | |
| body, | |
| }); | |
| } else { | |
| await github.rest.issues.createComment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: context.issue.number, | |
| body, | |
| }); | |
| } |