Files
headscale/.github/workflows/check-generated.yml
T

85 lines
2.4 KiB
YAML

name: Check Generated Files
on:
push:
branches:
- main
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }}
cancel-in-progress: true
defaults:
run:
shell: nix develop --fallback --command bash -e {0}
jobs:
check-generated:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7.0.1
with:
fetch-depth: 2
- name: Get changed files
id: changed-files
uses: dorny/paths-filter@v4.0.3
with:
filters: |
files:
- '*.nix'
- 'go.*'
- '**/*.go'
- 'flake.lock'
- 'tools/**'
- 'Makefile'
- 'docs/ref/configuration-options.md'
- 'docs/ref/config-example.yaml'
- 'nix/options.generated.nix'
- uses: NixOS/nix-installer-action@v1.0.0
if: steps.changed-files.outputs.files == 'true'
- uses: Mic92/hestia@v3.1.0
if: steps.changed-files.outputs.files == 'true'
- name: Run make generate
if: steps.changed-files.outputs.files == 'true'
run: make generate
- name: Check the configuration reference is mdformat-stable
if: steps.changed-files.outputs.files == 'true'
run: mdformat --check docs/ref/configuration-options.md
- name: Check for uncommitted changes
if: steps.changed-files.outputs.files == 'true'
run: |
if ! git diff --exit-code; then
echo "❌ Generated files are not up to date!"
echo "Please run 'make generate' and commit the changes."
exit 1
else
echo "✅ All generated files are up to date."
fi
# actions.lock is generated from GitHub, not from the tree, so it is
# verified upstream rather than regenerated and diffed.
actions-lock:
runs-on: ubuntu-latest
permissions:
contents: read
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v7.0.1
with:
persist-credentials: false
- uses: NixOS/nix-installer-action@v1.0.0
# The flake's own nixpkgs, so flake.lock moves the version rather than a
# second pin someone has to remember.
- name: Verify actions.lock
env:
GH_TOKEN: ${{ github.token }}
run: nix run --inputs-from . nixpkgs#gh-actions-lock -- --no-interactive --verify