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

chore(ci): replace mergify with automerge workflow #241

Merged
merged 5 commits into from
Dec 20, 2023
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
24 changes: 24 additions & 0 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: automerge
on:
pull_request_target:
types:
- opened
- labeled
- ready_for_review
- reopened
- synchronize
concurrency: ${{ github.workflow }}-${{ github.head_ref }}
jobs:
automerge:
runs-on: ubuntu-latest
permissions:
contents: read
if: contains(github.event.pull_request.labels.*.name, 'automerge') && !contains(github.event.pull_request.labels.*.name, 'do-not-merge') && github.event.pull_request.draft == false
steps:
- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Turn on automerge for this PR by a trusted user or bot
if: github.event.pull_request.user.login == 'team-tf-cdk' || contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.pull_request.author_association) || github.actor == 'dependabot[bot]'
env:
GH_TOKEN: ${{ secrets.GH_COMMENT_TOKEN }}
run: gh pr merge --auto --squash ${{ github.event.pull_request.number }}
15 changes: 12 additions & 3 deletions .github/workflows/diff-cdktf-stacks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,13 @@ jobs:
cli_config_credentials_token: ${{ secrets.TF_CLOUD_TOKEN }}
terraform_wrapper: false

- uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
- name: Setup Node.js
uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 # v4.0.0
with:
node-version: "18"

- run: yarn install
- name: Install
run: yarn install
- name: Synth
run: "$(yarn bin)/cdktf synth"
- name: Plan
Expand All @@ -45,8 +47,9 @@ jobs:
terraform plan -no-color | tee ../../../plan_stdout_${{ matrix.stack }}.txt; echo $?
set +o pipefail
continue-on-error: true
- uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
- name: Comment the plan output on the PR
if: contains(github.event_name, 'pull_request') # pull_request or pull_request_target
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ secrets.GH_COMMENT_TOKEN }}
script: |
Expand All @@ -62,3 +65,9 @@ jobs:
workflowName: "${{github.workflow}}",
stackName: "${{matrix.stack}}"
})
- name: Fail this check if the plan was not successful
if: ${{ steps.plan.outcome != "success" }}
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
core.setFailed('Terraform plan was not successful')