Skip to content

Commit dfc525c

Browse files
jfrochesamrose
authored andcommitted
feat: run actionlint on GitHub Actions workflows
Starting to lint GitHub Actions workflows with actionlint.
1 parent e3a832d commit dfc525c

File tree

3 files changed

+22
-6
lines changed

3 files changed

+22
-6
lines changed

.github/actionlint.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
self-hosted-runner:
2+
labels:
3+
- blacksmith-2vcpu-ubuntu-2404-arm
4+
- blacksmith-4vcpu-ubuntu-2404

.github/workflows/ami-release-nix.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
id: set-versions
3737
run: |
3838
VERSIONS=$(nix run nixpkgs#yq -- '.postgres_major[]' ansible/vars.yml | nix run nixpkgs#jq -- -R -s -c 'split("\n")[:-1]')
39-
echo "postgres_versions=$VERSIONS" >> $GITHUB_OUTPUT
39+
echo "postgres_versions=$VERSIONS" >> "$GITHUB_OUTPUT"
4040
4141
build:
4242
needs: prepare
@@ -69,8 +69,8 @@ jobs:
6969
7070
- name: Set PostgreSQL version environment variable
7171
run: |
72-
echo "POSTGRES_MAJOR_VERSION=${{ matrix.postgres_version }}" >> $GITHUB_ENV
73-
echo "EXECUTION_ID=${{ github.run_id }}-${{ matrix.postgres_version }}" >> $GITHUB_ENV
72+
echo "POSTGRES_MAJOR_VERSION=${{ matrix.postgres_version }}" >> "$GITHUB_ENV"
73+
echo "EXECUTION_ID=${{ github.run_id }}-${{ matrix.postgres_version }}" >> "$GITHUB_ENV"
7474
7575
- name: Generate common-nix.vars.pkr.hcl
7676
run: |
@@ -81,7 +81,7 @@ jobs:
8181
PG_VERSION="${PG_VERSION}-${SUFFIX}"
8282
echo "Added branch suffix to version: $SUFFIX"
8383
fi
84-
echo 'postgres-version = "'$PG_VERSION'"' > common-nix.vars.pkr.hcl
84+
echo "postgres-version = \"$PG_VERSION\"" > common-nix.vars.pkr.hcl
8585
# Ensure there's a newline at the end of the file
8686
echo "" >> common-nix.vars.pkr.hcl
8787
@@ -106,8 +106,8 @@ jobs:
106106
- name: Grab release version
107107
id: process_release_version
108108
run: |
109-
VERSION=$(cat common-nix.vars.pkr.hcl | sed -e 's/postgres-version = "\(.*\)"/\1/g')
110-
echo "version=$VERSION" >> $GITHUB_OUTPUT
109+
VERSION=$(sed -e 's/postgres-version = "\(.*\)"/\1/g' common-nix.vars.pkr.hcl)
110+
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
111111
echo "::notice title=AMI Published::Postgres AMI version: $VERSION"
112112
113113
- name: Create nix flake revision tarball

nix/hooks.nix

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
{ inputs, ... }:
2+
let
3+
ghWorkflows = builtins.attrNames (builtins.readDir ../.github/workflows);
4+
lintedWorkflows = [ "ami-release-nix.yml" ];
5+
in
26
{
37
imports = [ inputs.git-hooks.flakeModule ];
48
perSystem =
@@ -8,9 +12,17 @@
812
check.enable = true;
913
settings = {
1014
hooks = {
15+
actionlint = {
16+
enable = true;
17+
excludes = builtins.filter (name: !builtins.elem name lintedWorkflows) ghWorkflows;
18+
verbose = true;
19+
};
20+
1121
treefmt = {
1222
enable = true;
1323
package = config.treefmt.build.wrapper;
24+
pass_filenames = false;
25+
verbose = true;
1426
};
1527
};
1628
};

0 commit comments

Comments
 (0)