@@ -2,25 +2,30 @@ name: Acceptance Tests (github.com)
22
33on :
44 workflow_dispatch :
5- # push:
6- # branches:
7- # - main
8- # - release-v*
9- # pull_request_target:
10- # types:
11- # - opened
12- # - synchronize
13- # - reopened
14- # - labeled
15- # branches:
16- # - main
17- # - release-v*
5+ push :
6+ branches :
7+ - main
8+ - 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
3843 uses : actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3 # v6.0.0
3944
4045 - name : Check secrets
46+ if : github.event_name == 'pull_request_target'
4147 env :
42- INPUT_ALLOWED_SECRETS : ${{ vars.DOTCOM_ACCEPTANCE_TESTS_ALLOWED_SECRETS || 'DOTCOM_TEST_USER_TOKEN ' }}
48+ INPUT_ALLOWED_SECRETS : ${{ vars.DOTCOM_ACCEPTANCE_TESTS_ALLOWED_SECRETS || 'GH_TEST_TOKEN ' }}
4349 INPUT_SECRETS : ${{ toJSON(secrets) }}
4450 run : |
4551 set -eou pipefail
@@ -54,16 +60,16 @@ jobs:
5460 id : credentials
5561 if : matrix.mode != 'anonymous'
5662 env :
57- TEST_USER_TOKEN : ${{ secrets.DOTCOM_TEST_USER_TOKEN }}
63+ GH_TEST_TOKEN : ${{ secrets.GH_TEST_TOKEN }}
5864 run : |
5965 set -eou pipefail
6066
61- if [[ -z "${TEST_USER_TOKEN }" ]]; then
67+ if [[ -z "${GH_TEST_TOKEN }" ]]; then
6268 echo "::error::Missing credentials"
6369 exit 1
6470 fi
6571
66- echo "token=${TEST_USER_TOKEN }" >> "${GITHUB_OUTPUT}"
72+ echo "token=${GH_TEST_TOKEN }" >> "${GITHUB_OUTPUT}"
6773
6874 - name : Set-up Go
6975 uses : actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
@@ -77,13 +83,28 @@ jobs:
7783 TF_LOG : INFO
7884 GITHUB_TOKEN : ${{ steps.credentials.outputs.token }}
7985 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
86+ GITHUB_OWNER : ${{ (matrix.mode == 'individual' && vars.GH_TEST_LOGIN) || (matrix.mode == 'organization' && vars.GH_TEST_ORG_NAME) || '' }}
87+ GITHUB_USERNAME : ${{ vars.GH_TEST_LOGIN }}
88+ GITHUB_ENTERPRISE_SLUG : ${{ vars.GH_TEST_ENTERPRISE_SLUG }}
89+ GH_TEST_AUTH_MODE : ${{ matrix.mode }}
90+ GH_TEST_USER_REPOSITORY : ${{ vars.GH_TEST_USER_REPOSITORY }}
91+ GH_TEST_ORG_USER : ${{ vars.GH_TEST_ORG_USER }}
92+ GH_TEST_ORG_SECRET_NAME : ${{ vars.GH_TEST_ORG_SECRET_NAME }}
93+ GH_TEST_ORG_REPOSITORY : ${{ vars.GH_TEST_ORG_REPOSITORY }}
94+ GH_TEST_ORG_TEMPLATE_REPOSITORY : ${{ vars.GH_TEST_ORG_TEMPLATE_REPOSITORY }}
95+ GH_TEST_ORG_APP_INSTALLATION_ID : ${{ vars.GH_TEST_ORG_APP_INSTALLATION_ID }}
96+ GH_TEST_EXTERNAL_USER : ${{ vars.GH_TEST_EXTERNAL_USER }}
97+ GH_TEST_EXTERNAL_USER_TOKEN : ${{ secrets.GH_TEST_EXTERNAL_USER_TOKEN }}
98+ GH_TEST_EXTERNAL_USER2 : ${{ vars.GH_TEST_EXTERNAL_USER2 }}
99+ GH_TEST_ADVANCED_SECURITY : ${{ vars.GH_TEST_ADVANCED_SECURITY || 'false' }}
100+ run : |
101+ set -eou pipefail
102+
103+ if [[ "${GH_TEST_AUTH_MODE}" != "anonymous" ]]; then
104+ go test ./github -v -sweep=all
105+ fi
106+
107+ go test -run "^TestAcc*" ./github -v -race -coverprofile=coverage.txt -covermode=atomic -timeout 120m -count=1
87108
88109 check :
89110 name : Check DotCom Acceptance Tests
0 commit comments