# This is a basic workflow to help you get started with Actions

name: download upstream

on:
  workflow_dispatch:

jobs:
  build:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: actions/checkout@v4.1.1

      - name: prepare upstream list
        run: |
          git config --global user.email "action@github.com"
          git config --global user.name "GitHub Action[bot]"
          /bin/bash ./scripts/prepare-upstream.sh
          git add *
          git commit -am "download upstream."
      - name: push
        uses: ad-m/github-push-action@master
        with:
          branch: 'adlist-maker'
          github_token: ${{ secrets.PERSON_TOKEN }}
      - name: rebuild list
        run: |
          curl -s -m 30 -X POST "$GITHUB_API_URL/repos/$GITHUB_REPOSITORY/actions/workflows/auto-rebuild.yml/dispatches" -H "Accept: application/vnd.github.v3+json" -H "Authorization: token ${{ secrets.PERSON_TOKEN }}" -d '{"ref":"adlist-maker"}'
