Skip to content

Commit

Permalink
Introduce lychee for link checker (#1026)
Browse files Browse the repository at this point in the history
* Use lychee for link checker

* Remove lychee from lint command

* Fix lychee errors in markdown and nix files

* Don't depend on lychee-action

* Skip to check reddit links

* Set GITHUB_TOKEN for stable lychee
  • Loading branch information
kachick authored Jan 6, 2025
1 parent 0103ef6 commit 7859331
Show file tree
Hide file tree
Showing 9 changed files with 45 additions and 35 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
name: 👕
# Keep lightweght to run on every events.
# See https://github.com/kachick/selfup/blob/c53aad349e3577295a68b1b78ee4cb0eddc4e2b9/README.md#L97-L103 for the motivation
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
schedule:
# Every 10:42 JST
# https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule
- cron: '42 1 * * *'

jobs:
dprint:
Expand Down Expand Up @@ -39,3 +45,26 @@ jobs:
token: ${{ github.token }}
version: '0.20.0' # selfup {"extract":"\\d\\.\\d+\\.\\d+","replacer":["stylua", "--version"], "nth": 2}
args: --check .

# Don't use lycheeverse/lychee-action. There is no benefit rather than using the CLI for my use. And considering the targets should be simple with `git ls-files` rather than built-in glob
link-checker:
runs-on: ubuntu-24.04
env:
CLI_VERSION: '0.18.0' # selfup {"extract":"\\d\\.\\d+\\.\\d+","replacer":["lychee", "--version"], "nth": 2}
steps:
- uses: actions/checkout@v4
- name: Install
run: |
curl -OL 'https://github.com/lycheeverse/lychee/releases/download/lychee-v${{ env.CLI_VERSION }}/lychee-x86_64-unknown-linux-gnu.tar.gz'
tar zxvf lychee-x86_64-unknown-linux-gnu.tar.gz
mkdir --parents /home/runner/.lychee/bin
mv lychee /home/runner/.lychee/bin
echo '/home/runner/.lychee/bin' >> $GITHUB_PATH
- name: Run
env:
# Not GH_TOKEN for lychee.
# https://github.com/lycheeverse/lychee/blob/fc006bddc5a63067895799b83cbb9a4cbcabca6a/lychee-bin/src/options.rs#L459-L462
GITHUB_TOKEN: ${{ github.token }}
# Don't use glob. It often ignores .gitignore (why?)
run: |
git ls-files '*.md' '*.nix' | xargs lychee --
8 changes: 8 additions & 0 deletions .lycheeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# It returns 403 error agains lychee requests for each word
https://www.collinsdictionary.com/dictionary/

# False positve detection and hard to debug by https://github.com/lycheeverse/lychee/issues/1304
user:password

# reddit often rejects request from GitHub Actions
www.reddit.com/
1 change: 1 addition & 0 deletions cmd/lint/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func main() {
}

if *allFlag {
// FIXME: Adding lychee here making Network error
cmds = append(cmds, runner.Cmd{Path: "trivy", Args: []string{"config", "--exit-code", "1", "."}})
cmds = append(cmds, runner.Cmd{Path: "nix", Args: []string{"run", ".#check_nixf"}})
}
Expand Down
2 changes: 1 addition & 1 deletion config/firefox/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
1. Modify config with `about:preferences`
1. Open `about:config` again

And <https://github.com/yokoffing/Betterfox/blob/> helps to know the overview.
And <https://github.com/yokoffing/Betterfox/> helps to know the overview.

## How to change finder in page position from bottom to top?

Expand Down
1 change: 1 addition & 0 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@
trufflehog
# https://github.com/NixOS/nixpkgs/pull/362139
dprint
lychee
])
++ (with pkgs.my; [ nix-hash-url ])
++ [
Expand Down
2 changes: 1 addition & 1 deletion home-manager/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ nix-hash-url https://pkg.cloudflareclient.com/pool/noble/main/c/cloudflare-warp/

## How to convert JSON to Nix?

See [this comment](https://gist.github.com/Scoder12/0538252ed4b82d65e59115075369d34d?permalink_comment_id=4999658#gistcomment-4999658)
See [this comment](https://gist.github.com/spencerpogo/0538252ed4b82d65e59115075369d34d?permalink_comment_id=4999658#gistcomment-4999658)

```bash
nix-instantiate --eval -E 'builtins.fromJSON (builtins.readFile ./dprint.json)' | nixfmt
Expand Down
2 changes: 1 addition & 1 deletion nixos/hosts/moss/fingerprint.nix
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
enable = true;
# This select is a bit different of https://github.com/ramaureirac/thinkpad-e14-linux/blob/7539f51b1c29d116a549265f992032aa9642d4a5/tweaks/fingerprint/README.md#L19
# You should check actual vendor with `lsusb | grep FingerPrint`
# https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/development/libraries/libfprint-2-tod1-goodix-550a/default.nix#L9
# https://github.com/NixOS/nixpkgs/blob/nixos-24.11/pkgs/by-name/li/libfprint-2-tod1-goodix-550a/package.nix
driver = pkgs.libfprint-2-tod1-goodix-550a;
};

Expand Down
4 changes: 2 additions & 2 deletions windows/Multi-booting.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ Here is a note for me.

Problems

- [Unstable Wifi](/../../issues/663)
- [Wrong timestamp on dmesg](/../../issues/664)
- [Unstable Wifi](https://github.com/kachick/dotfiles/issues/663)
- [Wrong timestamp on dmesg](https://github.com/kachick/dotfiles/issues/664)

Solutions

Expand Down
31 changes: 1 addition & 30 deletions windows/Podman.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,35 +8,6 @@ See <https://github.com/containers/buildah/issues/3726#issuecomment-1171146242>
sudo mount --make-rshared /
```

## How to install

Use one of following.

- Directly Install podman into the debian family # Now using. The whole steps are written in [README](../README.md) and [WSL](WSL/README.md)
- [Install podman-desktop](./Podman-Remote.md), it easy to install but requires annoy setups with another WSL instance. # Old way, Written in this file

It needs special WSL distribution. How to run it from standard WSL ubuntu is written in [this document](https://podman-desktop.io/docs/podman/accessing-podman-from-another-wsl-instance).\
Make sure you are using podman binary as podman-remote, nixpkgs product does not satisfy.\
This repository aliases podman command to mise installed binary.

This is an worked example

```bash
# WSL - Ubuntu

podman system connection add --default podman-machine-default-user unix:///mnt/wsl/podman-sockets/podman-machine-default/podman-user.sock

# Since Ubuntu 24.04, you may need to update the usergroup of socket file
sudo chgrp "$(whoami)" /mnt/wsl/podman-sockets/podman-machine-default/podman-user.sock

# See wsl.nix for detail
# TODO: Update cmd/wsl-init
sudo systemctl enable ~/.config/systemd/user/mnt-wsl-instances-ubuntu24.mount --now

cdrepo irb-power_assert
podman run --volume /mnt/wsl/instances/ubuntu24/"$(pwd)":/workdir --workdir /workdir -it ghcr.io/ruby/ruby:master-dev-jammy-amd64-da66abc584a9a33693d1b5bbf70881a008b0935d
```

## After updating podman from 4.x -> 5.0.0, cannot do any operation even if the setup VM

```plaintext
Expand Down Expand Up @@ -67,7 +38,7 @@ Track the [official discussion](https://github.com/containers/podman/discussions
This repository provides a mount based solution, mount from another instance as /mnt/wsl/..., then podman-machine also can access there.

1. Ubuntu: Activate the home-manager with `--flake '.#kachick@wsl-ubuntu'`.
2. Look the [definitions](../../home-manager/wsl.nix), it includes how to mount with systemd.
2. Look the [definitions](../home-manager/wsl.nix), it includes how to mount with systemd.
3. podman-machine: Make sure podman-machine can read there `ls /mnt/wsl/instances/ubuntu24/home`
4. Ubuntu: `cdrepo project_path`
5. Ubuntu: `podman run -v /mnt/wsl/instances/ubuntu24/"$(pwd)":/workdir -it ghcr.io/ruby/ruby:master-dev-76732b3e7b42d23290cd96cd695b2373172c8a43-jammy`
Expand Down

0 comments on commit 7859331

Please sign in to comment.