Skip to content

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

Merged
merged 6 commits into from
Jan 9, 2022
Merged

automating maintenance with Github actions #290

merged 6 commits into from
Jan 9, 2022

Conversation

PatMyron
Copy link
Contributor

@PatMyron PatMyron commented Jan 7, 2022

@PatMyron PatMyron requested review from bendrucker and wata727 January 7, 2022 04:57
push:
branches: [ master ]
schedule:
- cron: '*/5 * * * *'
Copy link
Member

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?

Copy link
Contributor Author

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
Copy link
Member

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

Copy link
Contributor Author

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

Copy link
Member

@bendrucker bendrucker left a 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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.

Copy link
Contributor Author

@PatMyron PatMyron Jan 7, 2022

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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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
Copy link
Member

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.

Copy link
Contributor Author

@PatMyron PatMyron Jan 7, 2022

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

Copy link
Member

@bendrucker bendrucker left a 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.

@PatMyron
Copy link
Contributor Author

PatMyron commented Jan 9, 2022

Merging as-is to automatically pick up new AWS types to continue mapping
Feel free to continue tweaking / iterating with any improvements if desired

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants