66 # branches:
77 # - main
88 # - release-v*
9- # pull_request_target:
10- # types:
11- # - opened
12- # - synchronize
13- # - reopened
14- # - labeled
15- # branches:
16- # - main
17- # - release-v*
9+ pull_request :
10+ types :
11+ - opened
12+ - synchronize
13+ - reopened
14+ - labeled
15+ branches :
16+ - main
17+ - release-v*
18+
19+ concurrency :
20+ group : acctest-dotcom-${{ github.ref }}
21+ cancel-in-progress : true
1822
1923permissions : read-all
2024
2125jobs :
2226 test :
2327 name : Test ${{ matrix.mode }}
28+ if : (github.event_name != 'pull_request' && github.event_name != 'pull_request_target') || contains(github.event.pull_request.labels.*.name, 'acctest')
2429 runs-on : ubuntu-latest
2530 permissions :
2631 contents : read
2934 strategy :
3035 matrix :
3136 mode : [anonymous, individual, organization] # team, enterprise
32- fail-fast : false
37+ fail-fast : true
38+ max-parallel : 1
3339 defaults :
3440 run :
3541 shell : bash
3844 uses : actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
3945
4046 - name : Check secrets
47+ if : github.event_name == 'pull_request_target'
4148 env :
42- INPUT_ALLOWED_SECRETS : ${{ vars.DOTCOM_ACCEPTANCE_TESTS_ALLOWED_SECRETS || 'DOTCOM_TEST_USER_TOKEN ' }}
49+ INPUT_ALLOWED_SECRETS : ${{ vars.DOTCOM_ACCEPTANCE_TESTS_ALLOWED_SECRETS || 'GH_TEST_TOKEN ' }}
4350 INPUT_SECRETS : ${{ toJSON(secrets) }}
4451 run : |
4552 set -eou pipefail
@@ -54,36 +61,70 @@ jobs:
5461 id : credentials
5562 if : matrix.mode != 'anonymous'
5663 env :
57- TEST_USER_TOKEN : ${{ secrets.DOTCOM_TEST_USER_TOKEN }}
64+ GH_TEST_TOKEN : ${{ secrets.GH_TEST_TOKEN }}
5865 run : |
5966 set -eou pipefail
6067
61- if [[ -z "${TEST_USER_TOKEN }" ]]; then
68+ if [[ -z "${GH_TEST_TOKEN }" ]]; then
6269 echo "::error::Missing credentials"
6370 exit 1
6471 fi
6572
66- echo "token=${TEST_USER_TOKEN }" >> "${GITHUB_OUTPUT}"
73+ echo "token=${GH_TEST_TOKEN }" >> "${GITHUB_OUTPUT}"
6774
6875 - name : Set-up Go
6976 uses : actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
7077 with :
7178 go-version-file : go.mod
7279 cache : true
7380
81+ - name : Setup Terraform
82+ uses : hashicorp/setup-terraform@b9cd54a3c349d3f38e8881555d616ced269862dd # v3.1.2
83+ with :
84+ terraform_version : latest
85+ terraform_wrapper : false
86+
87+ - name : Terraform lookup
88+ id : tf
89+ run : |
90+ set -euo pipefail
91+
92+ {
93+ echo "version=$(terraform version -json | jq --raw-output '.terraform_version')"
94+ echo "path=$(command -v terraform || true)"
95+ } >> "${GITHUB_OUTPUT}"
96+
7497 - name : Run tests
7598 env :
99+ TF_ACC_PROVIDER_NAMESPACE : " "
100+ TF_ACC_TERRAFORM_VERSION : ${{ steps.tf.outputs.version }}
101+ TF_ACC_TERRAFORM_PATH : ${{ steps.tf.outputs.path }}
76102 TF_ACC : " 1"
77- TF_LOG : INFO
103+ TF_LOG : WARN
78104 GITHUB_TOKEN : ${{ steps.credentials.outputs.token }}
79105 GITHUB_BASE_URL : https://api.github.com/
80- GITHUB_TEST_TYPE : ${{ matrix.mode }}
81- GITHUB_OWNER : ${{ (matrix.mode == 'individual' && 'github-terraform-test-user') || (matrix.mode == 'organization' && 'terraformtesting') || '' }}
82- GITHUB_ORGANIZATION : ${{ (matrix.mode == 'organization' && 'terraformtesting') || '' }}
83- GITHUB_TEST_ORGANIZATION : ${{ (matrix.mode == 'individual' && 'terraformtesting') || '' }}
84- GITHUB_TEST_OWNER : ${{ (matrix.mode == 'organization' && 'github-terraform-test-user') || '' }}
85- GITHUB_TEST_USER_TOKEN : ${{ steps.credentials.outputs.token }}
86- run : go test -run "^TestAcc*" ./github -v -race -coverprofile=coverage.txt -covermode=atomic -timeout 120m -count=1
106+ GITHUB_OWNER : ${{ (matrix.mode == 'individual' && vars.GH_TEST_LOGIN) || (matrix.mode == 'organization' && vars.GH_TEST_ORG_NAME) || '' }}
107+ GITHUB_USERNAME : ${{ vars.GH_TEST_LOGIN }}
108+ GITHUB_ENTERPRISE_SLUG : ${{ vars.GH_TEST_ENTERPRISE_SLUG }}
109+ GH_TEST_AUTH_MODE : ${{ matrix.mode }}
110+ GH_TEST_USER_REPOSITORY : ${{ vars.GH_TEST_USER_REPOSITORY }}
111+ GH_TEST_ORG_USER : ${{ vars.GH_TEST_ORG_USER }}
112+ GH_TEST_ORG_SECRET_NAME : ${{ vars.GH_TEST_ORG_SECRET_NAME }}
113+ GH_TEST_ORG_REPOSITORY : ${{ vars.GH_TEST_ORG_REPOSITORY }}
114+ GH_TEST_ORG_TEMPLATE_REPOSITORY : ${{ vars.GH_TEST_ORG_TEMPLATE_REPOSITORY }}
115+ GH_TEST_ORG_APP_INSTALLATION_ID : ${{ vars.GH_TEST_ORG_APP_INSTALLATION_ID }}
116+ GH_TEST_EXTERNAL_USER : ${{ vars.GH_TEST_EXTERNAL_USER }}
117+ GH_TEST_EXTERNAL_USER_TOKEN : ${{ secrets.GH_TEST_EXTERNAL_USER_TOKEN }}
118+ GH_TEST_EXTERNAL_USER2 : ${{ vars.GH_TEST_EXTERNAL_USER2 }}
119+ GH_TEST_ADVANCED_SECURITY : ${{ vars.GH_TEST_ADVANCED_SECURITY || 'false' }}
120+ run : |
121+ set -eou pipefail
122+
123+ if [[ "${GH_TEST_AUTH_MODE}" != "anonymous" ]]; then
124+ go test ./github -v -sweep=all
125+ fi
126+
127+ go test -run "^TestAcc*" ./github -v -race -coverprofile=coverage.txt -covermode=atomic -timeout 120m -count=1
87128
88129 check :
89130 name : Check DotCom Acceptance Tests
0 commit comments