Skip to content

Fetch proxies, Run python sorter and Base64 #1910

Fetch proxies, Run python sorter and Base64

Fetch proxies, Run python sorter and Base64 #1910

Workflow file for this run

name: Fetch proxies, Run python sorter and Base64
on:
push:
paths:
- 'python/sorter.py'
- '.github/workflows/sorter.yml'
workflow_dispatch:
schedule:
- cron: "0 */4 * * *"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Create timestamped directory
run: |
mkdir -p ./archives/$(date +'%Y%m')
mkdir -p ./archives/$(date +'%Y%m')/$(date +'%Y-%m-%d_%H-%M-%S')
mkdir -p ./archives/IR/$(date +'%Y%m')/$(date +'%Y-%m-%d_%H-%M-%S')
cp submerge/converted.txt ./archives/$(date +'%Y%m')/$(date +'%Y-%m-%d_%H-%M-%S')/
cp output/IR.txt ./archives/IR/$(date +'%Y%m')/$(date +'%Y-%m-%d_%H-%M-%S')
- name: Grab content and update backup
run: |
curl https://raw.githubusercontent.com/Surfboardv2ray/Proxy-sorter/main/submerge/converted.txt -o archives/latest_backup/converted.txt # Replace with your actual URL
- name: Commit and push if there are changes
run: |
git config --local user.name 'Github Action'
git config --local user.email '[email protected]'
git add .
git commit -m "Archived backups"
git push
- name: Combine URL contents
run: |
# Replace with your URLs
URL1="${{ secrets.VMESS_URL }}"
URL2="${{ secrets.VLESS_URL }}"
# Fetch the contents
CONTENT1=$(curl -s "$URL1")
CONTENT2=$(curl -s "$URL2")
# Combine and save to a file
echo -e "$CONTENT1\n$CONTENT2" > input/proxies.txt
- name: Check for Input Changes
id: changesin
run: |
git diff --quiet && echo 'No changes' || echo '::set-output name=changed::true'
# Could always disable this section to apply bug fixes
- name: Stop if no changes
run: |
if [[ "${{ steps.changesin.outputs.changed }}" != "true" ]]; then
echo "No changes in input file, exiting"
echo "::error::No changes in input file, stopping workflow"
exit 1
fi
- name: Commit and push if there are changes
if: steps.changesin.outputs.changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add input/proxies.txt
git commit -m "Fetch proxies"
git push
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
- name: Run sorter script
env:
GET_IPGEO: ${{ secrets.GET_IPGEO }}
run: python python/sorter.py
- name: Check for Output Changes
id: changes
run: |
git diff --quiet && echo 'No changes' || echo '::set-output name=changed::true'
- name: Commit and push sorter changes
if: steps.changes.outputs.changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add output/converted.txt output/US.txt output/IR.txt
git commit -m "Update files" -a
git push
- name: Convert Converted to base64
run: |
content=$(cat output/converted.txt | base64 | tr -d '\n')
echo "$content" > submerge/converted.txt
- name: Convert IR to base64
run: |
content=$(cat output/IR.txt | base64 | tr -d '\n')
echo "$content" > submerge/IR.txt
- name: Convert US to base64
run: |
content=$(cat output/US.txt | base64 | tr -d '\n')
echo "$content" > submerge/US.txt
- name: Check for Base64 Changes
id: changes64
run: |
git diff --quiet && echo 'No changes' || echo '::set-output name=changed::true'
- name: Commit and Push Base64
if: steps.changes64.outputs.changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add submerge/*
git commit -m "Update output files"
git push
- name: Create timestamped directory
run: |
mkdir -p ./archives/ws_tls/$(date +'%Y%m')
mkdir -p ./archives/ws_tls/$(date +'%Y%m')/$(date +'%Y-%m-%d_%H-%M-%S')
cp ws_tls/proxies/wstls ./archives/ws_tls/$(date +'%Y%m')/$(date +'%Y-%m-%d_%H-%M-%S')/
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Run WSTLS
run: |
python python/wstls.py
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
- name: Run 7899
run: |
python python/7899.py
- name: Commit and push if it changed
run: |
git diff
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git commit -am "Update WS+TLS" || exit 0
git push
- name: Convert WSTLS to base64
run: |
content=$(cat ws_tls/proxies/wstls | base64 | tr -d '\n')
echo "$content" > ws_tls/proxies/wstls_base64
- name: Convert 7899 to base64
run: |
content=$(cat ws_tls/7899/7899 | base64 | tr -d '\n')
echo "$content" > ws_tls/7899/7899_base64
- name: Check for Base64 Changes
id: changes7899
run: |
git diff --quiet && echo 'No changes' || echo '::set-output name=changed::true'
- name: Commit and Push WSTLS Base64
if: steps.changes7899.outputs.changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
git add ws_tls/proxies/wstls_base64
git add ws_tls/7899/7899_base64
git commit -m "Update Base64"
git push
- name: Run script to select random lines
run: |
python selector/random_lines.py
- name: Push Random
if: steps.changesRandom.outputs.changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add selector/random
timestamp=$(TZ='Asia/Tehran' date)
git commit -m "✅Updated on ${timestamp}"
git push
- name: Convert Random to base64
run: |
> selector/random64
content=$(cat selector/random | base64 | tr -d '\n')
echo "$content" > selector/random64
- name: Check for Random base64 Changes
id: changesRandom64
run: |
git diff --quiet && echo 'No changes' || echo '::set-output name=changed::true'
- name: Push Random Base64
if: steps.changesRandom64.outputs.changed == 'true'
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add .
timestamp=$(TZ='Asia/Tehran' date)
git commit -m "✅Updated on ${timestamp}"
git push