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

Terraform 0.14 upgrade #18

Merged
merged 12 commits into from
Dec 11, 2020
51 changes: 51 additions & 0 deletions .github/mergify.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
pull_request_rules:
- name: "approve automated PRs that have passed checks"
conditions:
- "check-success~=test/bats"
- "check-success~=test/readme"
- "check-success~=test/terratest"
- "base=master"
- "author=cloudpossebot"
- "head~=auto-update/.*"
actions:
review:
type: "APPROVE"
message: "We've automatically approved this PR because the checks from the automated Pull Request have passed."

- name: "merge automated PRs when approved and tests pass"
conditions:
- "check-success~=test/bats"
- "check-success~=test/readme"
- "check-success~=test/terratest"
- "base=master"
- "head~=auto-update/.*"
- "#approved-reviews-by>=1"
- "#changes-requested-reviews-by=0"
- "#commented-reviews-by=0"
- "base=master"
- "author=cloudpossebot"
actions:
merge:
method: "squash"

- name: "delete the head branch after merge"
conditions:
- "merged"
actions:
delete_head_branch: {}

- name: "ask to resolve conflict"
conditions:
- "conflict"
actions:
comment:
message: "This pull request is now in conflicts. Could you fix it @{{author}}? 🙏"

- name: "remove outdated reviews"
conditions:
- "base=master"
actions:
dismiss_reviews:
changes_requested: true
approved: true
message: "This Pull Request has been updated, so we're dismissing all reviews."
92 changes: 92 additions & 0 deletions .github/workflows/auto-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: "auto-update"
on:
schedule:
# Update context.tf and README.md nightly
- cron: '0 0 * * *'

jobs:
context-update:
maximmi marked this conversation as resolved.
Show resolved Hide resolved
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Update context.tf
shell: bash
id: update
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
if [[ -f context.tf ]]; then
echo "context.tf exist! Fetching most recent version to see if there is an update"
maximmi marked this conversation as resolved.
Show resolved Hide resolved
curl -o context.tf -s https://raw.githubusercontent.com/cloudposse/terraform-null-label/master/exports/context.tf
maximmi marked this conversation as resolved.
Show resolved Hide resolved
if git diff --no-patch --exit-code context.tf; then
echo "No changes detected! Exiting the job..."
echo "MAKE_PR=false" >> $GITHUB_ENV
exit 0
else
echo "context.tf file was updated. Proceeding with PR..."
echo "MAKE_PR=true" >> $GITHUB_ENV
exit 0
fi
maximmi marked this conversation as resolved.
Show resolved Hide resolved
else
echo "context.tf does not exist! It is not enough to fetch context.tf, module requires to be updated to support it."
maximmi marked this conversation as resolved.
Show resolved Hide resolved
echo "MAKE_PR=false" >> $GITHUB_ENV
maximmi marked this conversation as resolved.
Show resolved Hide resolved
exit 0
fi
- name: Create Pull Request
if: ${{ success() && env.MAKE_PR == 'true' }}
maximmi marked this conversation as resolved.
Show resolved Hide resolved
uses: cloudposse/actions/github/create-pull-request@0.20.0
with:
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
commit-message: Update context.tf from origin source
title: Update context.tf
body: |-
## what
This is an auto-generated PR that updates the context.tf file
maximmi marked this conversation as resolved.
Show resolved Hide resolved
## why
To have most recent changes of `context`
maximmi marked this conversation as resolved.
Show resolved Hide resolved
branch: auto-update/context.tf
base: master
delete-branch: true
labels: |
auto-update
context
readme-update:
if: github.event_name == 'schedule'
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Update readme
shell: bash
id: update
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
run: |
make init
make readme/build
- name: Create Pull Request
uses: cloudposse/actions/github/create-pull-request@0.20.0
with:
token: ${{ secrets.PUBLIC_REPO_ACCESS_TOKEN }}
commit-message: Update README.md and docs
title: Update README.md and docs
body: |-
## what
This is an auto-generated PR that updates the README.md and docs
## why
To have most recent changes of README.md and doc from origin templates
branch: auto-update/readme
base: master
delete-branch: true
labels: |
auto-update
readme