|
| 1 | +name: "Validate Docs and Go Code" |
| 2 | +on: pull_request |
| 3 | + |
| 4 | +jobs: |
| 5 | + tfplugindocs: |
| 6 | + runs-on: ubuntu-latest |
| 7 | + steps: |
| 8 | + - name: Checkout repo |
| 9 | + uses: actions/checkout@v3 |
| 10 | + with: |
| 11 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 12 | + - name: Generate Docs |
| 13 | + run: | |
| 14 | + export PATH=$PATH:/home/runner/go/bin |
| 15 | + make docs-prepare |
| 16 | + tfplugindocs generate |
| 17 | + - id: docs-need-updating |
| 18 | + name: Validate No Changes |
| 19 | + run: | |
| 20 | + git diff --exit-code |
| 21 | + - name: Issue Comment on PR |
| 22 | + if: steps.docs-need-updating.output.outcome != 'success' |
| 23 | + uses: thollander/actions-comment-pull-request@v2.3.1 |
| 24 | + with: |
| 25 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 26 | + message: | |
| 27 | + :warning: Terraform Provider Docs need updating! |
| 28 | +
|
| 29 | + Run: |
| 30 | +
|
| 31 | + ```bash |
| 32 | + $ make docs |
| 33 | + ``` |
| 34 | +
|
| 35 | + Then commit the changes. |
| 36 | + pr_number: ${{ github.event.pull_request.number }} |
| 37 | + comment_tag: docs-need-updating |
| 38 | + |
| 39 | + gofmt: |
| 40 | + runs-on: ubuntu-latest |
| 41 | + steps: |
| 42 | + - name: Checkout repo |
| 43 | + uses: actions/checkout@v3 |
| 44 | + with: |
| 45 | + token: ${{ secrets.GITHUB_TOKEN }} |
| 46 | + - name: Run gofmt |
| 47 | + run: | |
| 48 | + go fmt |
| 49 | + - id: go-needs-formatting |
| 50 | + name: Validate No Changes |
| 51 | + run: | |
| 52 | + git diff --exit-code |
| 53 | + - name: Issue Comment on PR |
| 54 | + if: steps.go-needs-formatting.output.outcome != 'success' |
| 55 | + uses: thollander/actions-comment-pull-request@v2.3.1 |
| 56 | + with: |
| 57 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 58 | + message: | |
| 59 | + :warning: Go code needs formatting! |
| 60 | +
|
| 61 | + Run: |
| 62 | +
|
| 63 | + ```bash |
| 64 | + $ make fmt |
| 65 | + ``` |
| 66 | +
|
| 67 | + Then commit the changes. |
| 68 | + pr_number: ${{ github.event.pull_request.number }} |
| 69 | + comment_tag: go-needs-formatting |
0 commit comments