GitHub

Original file line numberDiff line numberDiff line change

@@ -10,19 +10,11 @@ permissions:

1010

contents: read

1111
1212

jobs:

13-

sast:

14-

name: Semgrep SAST

13+

checks:

14+

name: Flake checks

1515

runs-on: [self-hosted, nixos]

1616

steps:

1717

- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1

1818

with:

1919

persist-credentials: false

20-

- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0

21-

with:

22-

node-version: 24

23-

cache: npm

24-

- run: npm ci

25-

- run: npm run format:check

26-

- run: npm run lint

27-

- name: Scan JavaScript

28-

run: nix --extra-experimental-features "nix-command flakes" shell nixpkgs#semgrep --command semgrep scan --config p/javascript --error .

20+

- run: nix flake check --print-build-logs

Original file line numberDiff line numberDiff line change

@@ -0,0 +1,84 @@

1+

{

2+

description = "Reproducible checks for kelio-rewrite";

3+
4+

inputs = {

5+

nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";

6+

semgrep-rules = {

7+

url = "github:semgrep/semgrep-rules";

8+

flake = false;

9+

};

10+

};

11+
12+

outputs =

13+

{ nixpkgs, semgrep-rules, ... }:

14+

let

15+

systems = [

16+

"x86_64-linux"

17+

"aarch64-linux"

18+

];

19+

forAllSystems = nixpkgs.lib.genAttrs systems;

20+

in

21+

{

22+

checks = forAllSystems (

23+

system:

24+

let

25+

pkgs = nixpkgs.legacyPackages.${system};

26+

nodeModules = pkgs.importNpmLock.buildNodeModules {

27+

npmRoot = ./.;

28+

nodejs = pkgs.nodejs;

29+

};

30+

npmCheck =

31+

name: command:

32+

pkgs.stdenvNoCC.mkDerivation {

33+

inherit name;

34+

npmDeps = nodeModules;

35+

src = ./.;

36+

nativeBuildInputs = [

37+

pkgs.nodejs

38+

pkgs.importNpmLock.hooks.linkNodeModulesHook

39+

];

40+

buildPhase = command;

41+

installPhase = "touch $out";

42+

};

43+

in

44+

{

45+

actionlint =

46+

pkgs.runCommand "actionlint"

47+

{

48+

nativeBuildInputs = [ pkgs.actionlint ];

49+

}

50+

''

51+

actionlint -config-file ${./.github/actionlint.yaml} ${./.github/workflows/ci.yml}

52+

touch $out

53+

'';

54+

oxfmt = npmCheck "oxfmt" "npm run format:check";

55+

oxlint = npmCheck "oxlint" "npm run lint";

56+

semgrep =

57+

pkgs.runCommand "semgrep"

58+

{

59+

nativeBuildInputs = [ pkgs.semgrep ];

60+

SEMGREP_SEND_METRICS = "off";

61+

SSL_CERT_FILE = "${pkgs.cacert}/etc/ssl/certs/ca-bundle.crt";

62+

}

63+

''

64+

export HOME="$TMPDIR"

65+

semgrep scan --metrics off --config ${semgrep-rules}/javascript --error ${./.}

66+

touch $out

67+

'';

68+

}

69+

);

70+
71+

formatter = forAllSystems (

72+

system:

73+

let

74+

pkgs = nixpkgs.legacyPackages.${system};

75+

in

76+

pkgs.writeShellScriptBin "nix-fmt" ''

77+

if [ "$#" -eq 0 ]; then

78+

set -- flake.nix

79+

fi

80+

exec ${pkgs.nixfmt}/bin/nixfmt "$@"

81+

''

82+

);

83+

};

84+

}

Original file line numberDiff line numberDiff line change

@@ -81,7 +81,7 @@ async function main() {

8181

const messageBadgeage = document.createElement("p");

8282

messageBadgeage.classList.add("mt-2");

8383

if (messageBadgeageOld) {

84-

messageBadgeage.innerHTML = messageBadgeageOld.innerHTML;

84+

messageBadgeage.textContent = messageBadgeageOld.textContent;

8585

}

8686
8787

const old = document.body.querySelectorAll("*");

Read the original on github.com ↗