summaryrefslogtreecommitdiff
path: root/.github/workflows/data-update.yml
blob: c9c6b29a430c743e8d4423b7e95c81fc875a3e83 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: "Update searx.data"
on:
  schedule:
    - cron: "05 08 * * 5"

jobs:
  updateData:
    name: Update data - ${{ matrix.fetch }}
    runs-on: ubuntu-20.04
    if: ${{ github.repository_owner == 'searx'}}
    strategy:
      matrix:
        fetch:
          - ahmia_blacklist
          - currencies
          - external_bangs
          - firefox_version
          - languages
          - wikidata_units
    steps:
      - name: Checkout
        uses: actions/checkout@v2

      - name: Install Ubuntu packages
        run: |
          sudo ./utils/searx.sh install packages

      - name: Set up Python
        uses: actions/setup-python@v2
        with:
          python-version: '3.9'
          architecture: 'x64'

      - name: Cache Python dependencies
        id: cache-python
        uses: actions/cache@v2
        with:
          path: ./local
          key: python-ubuntu-20.04-3.9-${{ hashFiles('requirements*.txt', 'setup.py') }}

      - name: Install Python dependencies
        if: steps.cache-python.outputs.cache-hit != 'true'
        run: |
          make V=1 install

      - name: Fetch data
        env:
          FETCH_SCRIPT: utils/fetch_${{ matrix.fetch }}.py
        run: |
          source local/py3/bin/activate
          python $FETCH_SCRIPT

      - name: Create Pull Request
        id: cpr
        uses: peter-evans/create-pull-request@v3
        with:
          token: ${{ secrets.DATA_PR_TOKEN }}
          commit-message: Update searx.data - ${{ matrix.fetch }}
          committer: searx-bot <noreply@github.com>
          author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
          signoff: false
          branch: update_data_${{ matrix.fetch }}
          delete-branch: true
          draft: false
          title: 'Update searx.data - ${{ matrix.fetch }}'
          body: |
            Update searx.data - ${{ matrix.fetch }}
          labels: |
            data

      - name: Check outputs
        run: |
          echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
          echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"