Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

If no onion or i2p sites exist in json file, the github action will always fail #53

Open
sahal opened this issue Jul 26, 2024 · 1 comment · May be fixed by #54
Open

If no onion or i2p sites exist in json file, the github action will always fail #53

sahal opened this issue Jul 26, 2024 · 1 comment · May be fixed by #54

Comments

@sahal
Copy link

sahal commented Jul 26, 2024

Since #51 was merged in Actions have been failing: https://github.com/redlib-org/redlib-instances/actions

Screenshot_20240725_205735

It seems that maybe the last PR generated an instances.json without any .i2p or .onion links. I'm assuming (big assumption) that the instances.json file was generated with the -T flag.

The logic in the bash script is set to fail when jq exits non-zero.

    731         IFS=$'\n' imported_nonwww=($(jq -Mcer '.instances[] | select(.onion or .i2p)' "${import_nonwww_from_file}"))
    732         rc=$?
    733 
    734         if [[ ${rc} -ne 0 ]]
    735         then
    736             echo >&2 "Failed to read onion instances from existing JSON file."
    737             return 1
    738         fi
    739     fi

In my opinion, it should be logical to sometimes have a list of redlib instances without .onion or .i2p sites.

A lazy way to do this would be to set rc to 0 when you do not find .onion or .i2p in the json (via grep for example). I've proposed this in a linked PR.

Other options

  1. (schema fix) If you always expect an onion or i2p site to be running redlib then you'll have to check to see if people accidentally (or otherwise) generated the instances.json file without having Tor or I2p enabled. Maybe add a note to the json with the bash script flags or something.

  2. (process fix) Personally, I don't think its reasonable for people adding their own (or others) instances to have to run Tor to generate the instances.json. You might be able to solve this by always having the maintainers generate instances.json (assuming maintainers use Tor and i2p).

@sahal
Copy link
Author

sahal commented Jul 26, 2024

Just realized this failure might be a feature, not a bug. In that case, maybe its best to run the action at PR time too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant