Skip to content

Run Go Script

Run Go Script #22683

Workflow file for this run

name: Run Go Script
on:
schedule:
- cron: '*/10 * * * *'
permissions:
contents: write
jobs:
run-script:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: '^1.17'
- name: Set timezone
run: |
sudo ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
sudo dpkg-reconfigure -f noninteractive tzdata
- name: Run script
run: go run main.go -f providers.txt -o resolvers.txt
- name: Delete old check file
run: |
if ls last_update.txt 1> /dev/null 2>&1; then
rm last_update.txt
fi
- name: Create new check file
run: |
DATE=$(date '+%Y-%m-%d_%H-%M-%S')
echo "$DATE" > "last_update.txt"
- name: Commit changes
env:
GITHUB_TOKEN: ${{ secrets.ACTIONS_TOKEN }}
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add resolvers.txt last_update.txt
DATE=$(date '+%Y-%m-%d %H:%M:%S')
git commit -m "$DATE"
git push https://[email protected]/${{ github.repository }}.git --force