Skip to content

ERC-721 with Hardhat #16

ERC-721 with Hardhat

ERC-721 with Hardhat #16

name: ERC-721 with Hardhat
on:
push:
branches: [master]
paths:
- 'polkadot-docs/smart-contracts/nft-hardhat/**'
- '!polkadot-docs/smart-contracts/nft-hardhat/README.md'
pull_request:
paths:
- 'polkadot-docs/smart-contracts/nft-hardhat/**'
- '!polkadot-docs/smart-contracts/nft-hardhat/README.md'
workflow_dispatch:
jobs:
test:
# Guard: only run in the canonical repository to protect CI secrets
if: github.repository == 'polkadot-developers/polkadot-cookbook'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: '22'
# Install the Vitest wrapper's own dependencies (not the Hardhat project)
- name: Install wrapper dependencies
run: |
cd polkadot-docs/smart-contracts/nft-hardhat
npm ci
# Run the full 5-phase test suite.
# PRIVATE_KEY maps to HARDHAT_VAR_PRIVATE_KEY inside the test so
# Hardhat resolves vars.get('PRIVATE_KEY') without interactive prompts.
- name: Run tests
run: |
cd polkadot-docs/smart-contracts/nft-hardhat
npm test
env:
PRIVATE_KEY: ${{ secrets.TESTNET_PRIVATE_KEY }}
timeout-minutes: 20
post-test:
needs: test
# Only file issues on master — not on every PR failure
if: >
github.repository == 'polkadot-developers/polkadot-cookbook' &&
always() &&
github.ref == 'refs/heads/master'
uses: ./.github/workflows/post-cleanup.yml
with:
test_result: ${{ needs.test.result }}
readme_path: 'polkadot-docs/smart-contracts/nft-hardhat/README.md'
workflow_name: 'ERC-721 with Hardhat'
permissions:
contents: read
issues: write