Skip to content

Commit

Permalink
ci: Add repository input for chatops workflows (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
michalbil authored Feb 8, 2024
1 parent b9d657b commit c707a8e
Show file tree
Hide file tree
Showing 7 changed files with 44 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/apply-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ on:
description: Branch on which the tests should run
type: string
default: main
repository:
description: Repository on which the tests should run
type: string
required: false

jobs:
test:
Expand All @@ -49,5 +53,6 @@ jobs:
pr-id: ${{ inputs.pr-id }}
comment-id: ${{ inputs.comment-id }}
branch: ${{ inputs.branch }}
repository: ${{ inputs.repository }}
terratest_action: Apply
apply_timeout: 60
15 changes: 15 additions & 0 deletions .github/workflows/chatops.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,20 @@ jobs:
})
console.log(pr.data.head.ref)
return pr.data.head.ref
- name: get PR source repository
uses: actions/github-script@v6
id: src-repo
with:
result-encoding: string
script: |
let pr = await github.rest.pulls.get({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: context.issue.number,
})
console.log(pr.data.head.repo.full_name)
return pr.data.head.repo.full_name
- name: Generate GitHub token
id: generate-token
Expand Down Expand Up @@ -64,6 +78,7 @@ jobs:
pr-id=${{ github.event.issue.number }}
pr-title=${{ github.event.issue.title }}
branch=${{ steps.pr.outputs.result }}
repository=${{ steps.src-repo.outputs.result }}
- name: Edit comment with error message
if: steps.scd.outputs.error-message
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/help-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ on:
description: Branch on which the tests should run
type: string
default: main
repository:
description: Repository on which the tests should run
type: string
required: false

jobs:
help:
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/idempotence-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ on:
description: Branch on which the tests should run
type: string
default: main
repository:
description: Repository on which the tests should run
type: string
required: false

jobs:
test:
Expand All @@ -49,5 +53,6 @@ jobs:
pr-id: ${{ inputs.pr-id }}
comment-id: ${{ inputs.comment-id }}
branch: ${{ inputs.branch }}
repository: ${{ inputs.repository }}
terratest_action: Idempotence
apply_timeout: 60
5 changes: 5 additions & 0 deletions .github/workflows/plan-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ on:
description: Branch on which the tests should run
type: string
default: main
repository:
description: Repository on which the tests should run
type: string
required: false

jobs:
test:
Expand All @@ -49,4 +53,5 @@ jobs:
pr-id: ${{ inputs.pr-id }}
comment-id: ${{ inputs.comment-id }}
branch: ${{ inputs.branch }}
repository: ${{ inputs.repository }}
terratest_action: Plan
5 changes: 5 additions & 0 deletions .github/workflows/sca-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ on:
description: Branch on which the tests should run
type: string
default: main
repository:
description: Repository on which the tests should run
type: string
required: false

jobs:
init:
Expand Down Expand Up @@ -58,6 +62,7 @@ jobs:
with:
pre-commit-hooks: terraform_fmt terraform_docs terraform_tflint checkov
branch: ${{ inputs.branch }}
repository: ${{ inputs.repository }}

finish_comment_pr:
name: Add a comment to originating PR
Expand Down
5 changes: 5 additions & 0 deletions .github/workflows/validate-command.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ on:
description: Branch on which the tests should run
type: string
default: main
repository:
description: Repository on which the tests should run
type: string
required: false

jobs:
test:
Expand All @@ -50,4 +54,5 @@ jobs:
pr-id: ${{ inputs.pr-id }}
comment-id: ${{ inputs.comment-id }}
branch: ${{ inputs.branch }}
repository: ${{ inputs.repository }}
terratest_action: Validate

0 comments on commit c707a8e

Please sign in to comment.