Skip to content

Commit 23ac5ee

Browse files
committed
gh action
1 parent ef51f8f commit 23ac5ee

File tree

1 file changed

+24
-13
lines changed

1 file changed

+24
-13
lines changed

.github/workflows/testacc.yml

+24-13
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ permissions:
2020

2121
jobs:
2222
build:
23-
if: github.event.issue.pull_request && contains(github.event.comment.body, '/run-testacc')
2423
name: Build
2524
runs-on: ubuntu-latest
2625
timeout-minutes: 5
@@ -37,8 +36,8 @@ jobs:
3736
# This job runs on issue_comment event with /run-testacc command.
3837
# We will block merging to main unless this job passes
3938
# The reason we don't want to run this on every push is because it's expensive/creates real resources
40-
if: ${{ github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '/run-testacc') }}
41-
name: Terraform Provider Acceptance Tests
39+
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '/testacc') }}
40+
name: PR Terraform Provider Acceptance Tests
4241
needs: build
4342
runs-on: ubuntu-latest
4443
environment: dev
@@ -51,25 +50,37 @@ jobs:
5150
- '1.7.*'
5251
- '1.6.*'
5352
steps:
54-
- uses: actions/checkout@9bb56186c3b09b4f86b1c65136769dd318469633 # v4.1.2
53+
- name: Get PR branch
54+
uses: xt0rted/pull-request-comment-branch@v1
55+
id: comment-branch
56+
- name: Set latest commit status as pending
57+
uses: myrotvorets/set-commit-status-action@master
58+
with:
59+
sha: ${{ steps.comment-branch.outputs.head_sha }}
60+
token: ${{ secrets.GITHUB_TOKEN }}
61+
status: pending
62+
- name: Checkout PR branch
63+
uses: actions/checkout@v3
64+
with:
65+
ref: ${{ steps.comment-branch.outputs.head_ref }}
5566
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491 # v5.0.0
5667
with:
5768
go-version-file: 'go.mod'
5869
cache: true
59-
- uses: hashicorp/setup-terraform@a1502cd9e758c50496cc9ac5308c4843bcd56d36 # v3.0.0
60-
with:
61-
terraform_version: ${{ matrix.terraform }}
62-
terraform_wrapper: false
6370
- run: go mod download
64-
- env:
65-
TF_ACC: "1"
66-
run: make testacc
67-
timeout-minutes: 10
71+
- run: go build -v .
72+
- name: Set latest commit status as ${{ job.status }}
73+
uses: myrotvorets/set-commit-status-action@master
74+
if: always()
75+
with:
76+
sha: ${{ steps.comment-branch.outputs.head_sha }}
77+
token: ${{ secrets.GITHUB_TOKEN }}
78+
status: ${{ job.status }}
6879

6980
main-testacc:
7081
# This job runs on push to main branch.
7182
if: ${{ github.event_name == 'push' }}
72-
name: Terraform Provider Acceptance Tests
83+
name: Main Terraform Provider Acceptance Tests
7384
needs: build
7485
environment: dev
7586
timeout-minutes: 15

0 commit comments

Comments
 (0)