Skip to content

Commit

Permalink
fix pre-commit on ci (#32)
Browse files Browse the repository at this point in the history
The `terraform-fmt` check requires terraform to be installed and therefore was failing on pre-commit.ci.
While hooks in the `.pre-commit-config.yaml` can install extra dependencies per hook 
via the `additional_dependencies` key [1] I don't believe terraform can be installed this way currently,
and pre-commit.ci does not seem to provide additional mechanisms for installing dependencies.

We therefore disable those checks on pre-commit.ci and switch to running pre-commit
on GitHub actions, where we have more control over the environment.

Note: Since we are running pre-commit on GitHub actions, one might want to disable pre-commit.ci
for this repository altogether, but it is currently enabled across all repositories of the aiidalab
organization. Disabling it would require enabling pre-commit.ci for each repository individually.

[1] https://pre-commit.com/#config-additional_dependencies

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
ltalirz and pre-commit-ci[bot] authored Nov 8, 2022
1 parent b97e81e commit 75e3290
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .github/workflows/ci-style.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: continuous-integration-style

on:
- push
- pull_request

jobs:

pre-commit:

runs-on: ubuntu-latest
timeout-minutes: 30

steps:
- uses: actions/checkout@v2

- uses: hashicorp/setup-terraform@v2

- name: Install system dependencies
run: |
# tflint
curl -s https://raw.githubusercontent.com/terraform-linters/tflint/master/install_linux.sh | bash
- uses: actions/setup-python@v3
- uses: pre-commit/[email protected]
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
---
ci:
# skip checks that require terraform to be installed
skip: [tflint, terraform-fmt]

repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
Expand Down
2 changes: 1 addition & 1 deletion template/{{hostname}}/main.tf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
data "azurerm_resource_group" "default" {
name = "{{ azurerm_resource_group_name }}"
name = "{{ azurerm_resource_group_name }}"
}

module "cluster" {
Expand Down

0 comments on commit 75e3290

Please sign in to comment.