Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/pull-request-opt-in-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,21 @@ jobs:
run: |
FILES="${{ steps.getfile.outputs.files }}"
for domain in $FILES; do
RESPONSE_CODE=$(curl --silent --connect-timeout 5 --output /dev/null -I --write-out "%{http_code}" "http://${domain}/dsr_opt_in.txt" || echo "000")
NODEINFO=$(curl -L "http://${domain}/nodeinfo/2.0" | jq -r '.["metadata"] | .["optInServerRecommendation"]'|| echo "000")

if [ "$RESPONSE_CODE" -ne 200 ]; then
echo "$domain is not reachable Statuscode: $RESPONSE_CODE"
if [[ "$NODEINFO" == 'true' ]]; then
echo "$domain exposes optInServerRecommendation: $NODEINFO"
elif [[ "$NODEINFO" == 'false' ]]; then
echo "$domain exposes optInServerRecommendation: $NODEINFO"
FAILED=$((FAILED + 1))
else
echo "$domain exists and is reachable Statuscode: $RESPONSE_CODE"
echo "$domain does not expose optInServerRecommendation or is not reachable"
FAILED=$((FAILED + 1))
fi
done

if [ "$FAILED" -gt 0 ]; then
echo "not all endpoint could be reached"
exit 1
fi
shell: bash
Loading