mirror of
https://github.com/outbackdingo/homelab-v.git
synced 2026-08-25 14:53:19 +00:00
feat(ci): only run tofu fmt when necessary
Signed-off-by: Vegard Hagen <[email protected]>
This commit is contained in:
@@ -2,13 +2,14 @@ FROM docker.io/ubuntu:24.04
|
|||||||
|
|
||||||
ARG TARGETARCH
|
ARG TARGETARCH
|
||||||
|
|
||||||
ARG USER_ID=1000
|
ARG USER_ID=1001
|
||||||
ARG USER_GID=1000
|
ARG USER_GID=1001
|
||||||
ARG USERNAME=dev
|
ARG USERNAME=dev
|
||||||
|
|
||||||
RUN userdel ubuntu && \
|
# Remove ubuntu user
|
||||||
rm -rf /home/ubuntu
|
RUN userdel -r ubuntu
|
||||||
|
|
||||||
|
# Install common packages
|
||||||
RUN apt-get update && \
|
RUN apt-get update && \
|
||||||
apt-get install -y --no-install-recommends \
|
apt-get install -y --no-install-recommends \
|
||||||
apt-transport-https \
|
apt-transport-https \
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
name: OpenTofu validation
|
name: Tofu format
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
@@ -9,31 +9,26 @@ on:
|
|||||||
- '**.tfvars'
|
- '**.tfvars'
|
||||||
- '**.tftpl'
|
- '**.tftpl'
|
||||||
pull_request:
|
pull_request:
|
||||||
branches: [ main ]
|
types: [ opened, synchronize ]
|
||||||
pull_request_target:
|
branches: [ '**' ]
|
||||||
branches: [ main ]
|
paths:
|
||||||
|
- '**.tf'
|
||||||
|
- '**.tofu'
|
||||||
|
- '**.tfvars'
|
||||||
|
- '**.tftpl'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
tofu-format:
|
tofu-format:
|
||||||
name: Validate
|
name: run tofu format
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
env:
|
|
||||||
TOFU_DIR: tofu
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
|
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
|
||||||
|
|
||||||
- name: Login to GitHub Container Registry
|
|
||||||
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 #v3.4.0
|
|
||||||
with:
|
|
||||||
registry: ghcr.io
|
|
||||||
username: ${{ github.repository_owner }}
|
|
||||||
password: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Tofu format
|
- name: Tofu format
|
||||||
uses: docker://ghcr.io/vehagn/homelab-devcontainer
|
uses: docker://ghcr.io/vehagn/homelab-devcontainer
|
||||||
with:
|
with:
|
||||||
args: tofu -chdir=${{ env.TOFU_DIR }} fmt -recursive -diff -check
|
args: tofu fmt -recursive -diff -check
|
||||||
|
|||||||
Reference in New Issue
Block a user