Skip to content
This repository has been archived by the owner on Nov 5, 2024. It is now read-only.

Commit

Permalink
actions: Set up shellcheck and apply suggested changes
Browse files Browse the repository at this point in the history
  • Loading branch information
etu committed Jun 7, 2021
1 parent 40ab1ff commit 2c7859f
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@ name: Codestyle checks
- nodejs-frontend # TODO: Remove me when web-frontend is merged

jobs:
shellcheck:
name: Run shellcheck style checks
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]

- uses: cachix/install-nix-action@v13
with:
nix_path: nixpkgs=channel:nixos-unstable

- name: Prefetch shell.nix
run: 'nix-shell --run true'

- run: nix-shell --run "make shellcheck"

yamllint:
name: Run yamllint on github actions files
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
shellcheck:
shellcheck checkup.bash

yamllint:
yamllint -s -f github .github/workflows/*
4 changes: 2 additions & 2 deletions checkup.bash
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,15 @@ cmd_checkup_check_file() {
endOfHash=${hash:5:35}

# Get filtered leaked hashes
leakedHashes=$(curl -H 'user-agent: pass-checkup-extension; github.com/etu/pass-checkup' -s "https://api.pwnedpasswords.com/range/${startOfHash}" | grep -i $endOfHash)
leakedHashes=$(curl -H 'user-agent: pass-checkup-extension; github.com/etu/pass-checkup' -s "https://api.pwnedpasswords.com/range/${startOfHash}" | grep -i "$endOfHash")

# Define some color codes
RED='\033[0;31m'
GREEN='\033[0;32m'
NC='\033[0m' # No Color

# Check if password is leaked or not
if test $(echo -n $leakedHashes | wc -c) = 0; then
if test "$(echo -n "$leakedHashes" | wc -c)" = 0; then
echo -e "${GREEN}${path}: Password is probably not leaked ✔️${NC}"
else
RETURNCODE=2
Expand Down
3 changes: 3 additions & 0 deletions shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ pkgs.mkShell {
# Install GNU Make for shorthands
pkgs.gnumake

# Install shellcheck
pkgs.shellcheck

# Install yaml lint
pkgs.yamllint
];
Expand Down

0 comments on commit 2c7859f

Please sign in to comment.