Update sites list #20310
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update sites list | |
on: | |
schedule: | |
- cron: '0 * * * *' | |
workflow_dispatch: | |
push: | |
paths: | |
- ".upptimerc-custom.yml" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check Out Repo | |
uses: actions/checkout@v2 | |
- name: Check Out Repo searxng/searx-instances | |
uses: actions/checkout@v2 | |
with: | |
repository: "searxng/searx-instances" | |
ref: 'master' | |
path: 'searx-instances' | |
- name: Install yq | |
run: | | |
sudo wget https://github.com/mikefarah/yq/releases/download/v4.25.2/yq_linux_amd64 -O /usr/bin/yq && \ | |
sudo chmod +x /usr/bin/yq | |
shell: bash | |
- name: Update the sites list on .upptimerc.yml | |
run: | | |
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git | |
yq '.sites = [{"name": "searx.space", "url": "https://searx.space"}]' -i .upptimerc.yml | |
while read -r address | |
do | |
domain=$(echo "$address" | awk -F[/:] '{print $4}') | |
domain=$domain address=$address yq '.sites += {"name": env(domain), "url": env(address)}' -i .upptimerc.yml | |
done < <(yq e 'to_entries | .[] | .key' searx-instances/searxinstances/instances.yml | grep -v onion | grep -v i2p) | |
yq eval-all -i 'select(fileIndex == 0) *+ select(fileIndex == 1)' .upptimerc.yml .upptimerc-custom.yml | |
if [ -n "$(git diff --exit-code)" ]; then | |
git config user.name "SearXNG" | |
git config user.email "contact@searxng.org" | |
git add .upptimerc.yml | |
git commit -m "update sites list" | |
git push | |
fi | |
shell: bash |