Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Node.js v20, bump most deps, support OpenTofu #40

Merged
merged 8 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ on:
- master
- 'v*'
env:
node_version: "16.x"
node_version: "20.x"

jobs:
build: # make sure build/ci work properly
name: Build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.node_version }}
cache: yarn
Expand All @@ -33,10 +33,10 @@ jobs:
name: Audit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.node_version }}
cache: yarn
Expand All @@ -48,10 +48,10 @@ jobs:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.node_version }}
cache: yarn
Expand All @@ -66,10 +66,10 @@ jobs:
name: Test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: ${{ env.node_version }}
cache: yarn
Expand Down
27 changes: 23 additions & 4 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
env:
tf_version: 0.12.27
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ env.tf_version }}
Expand All @@ -32,7 +32,7 @@ jobs:
env:
tf_version: 0.12.27
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ env.tf_version }}
Expand All @@ -53,7 +53,7 @@ jobs:
env:
tf_version: 0.12.27
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: hashicorp/setup-terraform@v2
with:
terraform_version: ${{ env.tf_version }}
Expand All @@ -75,7 +75,7 @@ jobs:
env:
tf_version: 0.12.27
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- run: mv __tests__/* .
- uses: hashicorp/setup-terraform@v2
with:
Expand All @@ -87,3 +87,22 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
terraform-plan-file: test-plan.tfplan
comment-title: Terraform Plan from root

tofu: # make sure the action works when using tofu
name: Tofu
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: opentofu/setup-opentofu@v1
with:
tofu_version: 1.6.0
- run: tofu init
working-directory: __tests__
- run: tofu plan -out test-plan.tfplan
working-directory: __tests__
- uses: ./
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
working-directory: __tests__
terraform-plan-file: test-plan.tfplan
comment-title: Tofu Plan
16 changes: 6 additions & 10 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,9 @@ const basicTestPlan: TerraformPlan = {
process.env['GITHUB_REPOSITORY'] = 'https://github.com/byu-oit/github-action-tf-plan-comment'

test('Test Basic Plan Summary', async () => {
const scope = nock('https://api.github.com')
.get(/.*/)
.reply(200, {
html_url: 'https://test/workflow/url'
})
const scope = nock('https://api.github.com').get(/.*/).reply(200, {
html_url: 'https://test/workflow/url'
})

const commenter = new PlanCommenter({
octokit: github.getOctokit('fake'),
Expand Down Expand Up @@ -60,11 +58,9 @@ No changes detected`
})

test('Test Basic Plan with custom title', async () => {
const scope = nock('https://api.github.com')
.get(/.*/)
.reply(200, {
html_url: 'https://test/workflow/url'
})
const scope = nock('https://api.github.com').get(/.*/).reply(200, {
html_url: 'https://test/workflow/url'
})

const commenter = new PlanCommenter({
octokit: github.getOctokit('fake'),
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ inputs:
description: Title of the comment
default: Terraform Plan
runs:
using: 'node16'
using: 'node20'
main: 'dist/index.js'
Loading
Loading