Skip to content

feat: Refactored acceptance test automation #3

feat: Refactored acceptance test automation

feat: Refactored acceptance test automation #3

name: Acceptance Tests (github.com)
on:
workflow_dispatch:
pull_request:
types:
- opened
- synchronize
- reopened
branches:
- main
permissions: read-all
jobs:
test:
name: Test ${{ matrix.type }}
# if: contains(github.event.pull_request.labels.*.name, 'acctest')
# environment:
# name: dotcom
runs-on: ubuntu-latest
permissions:
contents: read
strategy:
matrix:
type: [anonymous, individual, organization, enterprise]
fail-fast: false
defaults:
run:
shell: bash
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set-up Go
uses: actions/setup-go@41dfa10bad2bb2ae585af6ee5bb4d7d973ad74ed # v5.1.0
with:
go-version-file: go.mod
cache: true
- name: Check credentials
if: matrix.type != 'anonymous'
run: |
if [[ -z "${{ secrets.DOTCOM_TEST_USER_TOKEN }}" ]]; then
echo "Missing credentials" >&2
exit 1
fi
- name: Run tests
env:
TF_LOG: INFO
GITHUB_BASE_URL: https://api.github.com/
GITHUB_TEST_ORGANIZATION: terraformtesting
GITHUB_TEST_OWNER: github-terraform-test-user
GITHUB_TEMPLATE_REPOSITORY: terraform-template-module
GITHUB_TEMPLATE_REPOSITORY_RELEASE_ID: "25117183"
GITHUB_OWNER: ${{ matrix.type == 'individual' && 'github-terraform-test-user' || '' }}
GITHUB_ORGANIZATION: ${{ matrix.type == 'organization' && 'terraformtesting' || '' }}
GITHUB_TOKEN: ${{ matrix.type != 'anonymous' && secrets.DOTCOM_TEST_USER_TOKEN || '' }}
run: make testacc