-
Notifications
You must be signed in to change notification settings - Fork 75
automating maintenance with Github actions #290
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
Conversation
push: | ||
branches: [ master ] | ||
schedule: | ||
- cron: '*/5 * * * *' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems aggressive to run every 5 minutes. I thought it was enough to run it daily. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
usually unsubscribe from notifications from the generated PRs
go generate ./... | ||
cd tools/provider-schema | ||
terraform init -upgrade | ||
terraform providers schema -json > schema.json |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I'm surprised that ubuntu-latest includes Terraform by default.
https://github.com/actions/virtual-environments/blob/cd453927cac82e4dc2658bb65d42b2c97eb83212/images/linux/scripts/installers/terraform.sh
However, this action may fail when a new version is released. It seems good to pin the version using setup-terraform.
https://github.com/hashicorp/setup-terraform
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the pointer, considered installing tfenv
as recommended in our docs but knew there were issues installing it when terraform was already installed. I'll look into that instead
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, thanks for this!
with: | ||
commit-message: | | ||
autogenerated maintenance | ||
title: autogenerated maintenance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
title: autogenerated maintenance | |
title: Generate rules from terraform-provider-aws |
Would be nice to append @version
as well, but that may increase the difficulty of targeting the PR. Dependabot/Renovate do something like this but probably w/ considerable logic involved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also not elegant, but I've just manually appended version numbers to autogenerated PR titles in the past due to complexities of appending it automatically:
aws-cloudformation/cfn-lint-visual-studio-code#76
- uses: peter-evans/create-pull-request@v3 | ||
with: | ||
commit-message: | | ||
autogenerated maintenance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
autogenerated maintenance | |
Generate rules from terraform-provider-aws. Automatically generated via the [maintenance](.github/workflows/maintenance.yaml) workflow. |
cd tools/provider-schema | ||
terraform init -upgrade | ||
terraform providers schema -json > schema.json | ||
- uses: peter-evans/create-pull-request@v3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When this pull request is created, it will not trigger workflows, since GH Actions forbids recursion when using secrets.GITHUB_TOKEN
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not elegant, but I usually just close/re-open the PRs to manually kick off the tests:
peter-evans/create-pull-request#48
added to the body of the generated PRs in case we ever need a reminder about that workaround
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We do need to figure out the recursive check runs. This is why I haven't undertaken more auto-generation already. Putting a PAT in is a fair bit of inconvenience but we can do it at the org level I guess.
Merging as-is to automatically pick up new AWS types to continue mapping |
similar to aws-cloudformation/cfn-lint#1792
currently running and updating this PR in my fork: https://github.com/PatMyron/tflint-ruleset-aws/pull/2