A GitHub Action that auto-generates Go interfaces (and optionally mocks & tests) for AWS SDK Go v2 services using nmccready/aws-sdk-go-v2-ifaces.
AWS SDK Go v2 doesn't ship interfaces for service clients, making it hard to mock in tests. This action generates IClient interfaces for any (or all) AWS services so you can write testable Go code.
- uses: brickhouse-tech/aws-ifaces-action@v1
with:
services: 's3,dynamodb,sqs'
commit-results: 'true'name: Generate AWS Interfaces
on:
schedule:
- cron: '0 0 * * 1' # Weekly on Monday
workflow_dispatch:
jobs:
generate:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- uses: brickhouse-tech/aws-ifaces-action@v1
with:
services: 's3,dynamodb,sqs,lambda'
output-dir: 'pkg/awsifaces/service'
commit-results: 'true'
commit-message: 'chore: regenerate AWS SDK interfaces'name: Update AWS Interfaces
on:
schedule:
- cron: '0 0 1 * *' # Monthly
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: brickhouse-tech/aws-ifaces-action@v1
id: generate
with:
create-pr: 'true'
pr-title: 'chore: update AWS SDK Go v2 interfaces'
generate-mocks: 'true'- uses: brickhouse-tech/aws-ifaces-action@v1
id: ifaces
with:
services: 's3'
- name: Run tests
if: steps.ifaces.outputs.has-changes == 'true'
run: go test ./...| Input | Description | Default |
|---|---|---|
services |
Comma-separated AWS service names (empty = all) | '' (all) |
generate-mocks |
Also generate mocks via mockery | 'false' |
generate-tests |
Also generate tests | 'false' |
output-dir |
Output directory (relative to workspace) | 'service' |
ifaces-version |
Version/ref of aws-sdk-go-v2-ifaces | 'main' |
commit-results |
Commit generated files to the repo | 'false' |
commit-message |
Commit message | 'chore: update auto-generated AWS SDK Go v2 interfaces' |
create-pr |
Create a PR instead of direct commit | 'false' |
pr-title |
PR title | 'chore: update auto-generated AWS SDK Go v2 interfaces' |
pr-branch |
Branch name for PR | 'auto-update/aws-ifaces' |
go-version |
Go version | '1.24' |
node-version |
Node.js version | '20' |
| Output | Description |
|---|---|
generated-services |
Comma-separated list of services generated |
has-changes |
'true' if files were changed |
- Clones nmccready/aws-sdk-go-v2-ifaces
- Clones the latest AWS SDK Go v2 source
- Extracts public
Clientmethod signatures from each service - Generates
IClientinterfaces in{service}/{service}_iface/iface.go - Optionally generates mocks (via mockery) and tests
- Copies results to your repo and optionally commits or creates a PR
MIT