diff --git a/.github/workflows/commons-update.yml b/.github/workflows/commons-update.yml new file mode 100644 index 0000000..dfc00e5 --- /dev/null +++ b/.github/workflows/commons-update.yml @@ -0,0 +1,61 @@ +on: + push: + branches: [ "main"] + pull_request: + branches: [ "main" ] + + schedule: + - cron: '0 23 * * *' + +permissions: write-all + +env: + PYWIKIBOT_TEST_RUNNING: 1 + PYWIKIBOT_USERNAME: Athulvis + PYWIKIBOT_LOGIN_LOGOUT: 1 + +jobs: + build: + + runs-on: ubuntu-latest + strategy: + fail-fast: false + max-parallel: 1 + + matrix: + python-version: ["pypy3.7", "3.7", "3.8", "3.9", "3.10", "3.11", "3.12"] + site: ['commons:commons'] + include: + - python-version: 3.10 + site: commons:commons + + + steps: + - uses: actions/checkout@v3 + - name: Set up Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install -r requirements.txt + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + + - name: Generate user files + run: | + python -Werror::UserWarning -m pwb generate_user_files -site:${{matrix.site}} -user:${{ env.PYWIKIBOT_USERNAME }} -v -debug; + + echo "usernames['commons']['commons'] = '${{ env.PYWIKIBOT_USERNAME }}'" >> user-config.py + echo "max_retries = 3" >> user-config.py + echo "noisysleep = float('inf')" >> user-config.py + echo "maximum_GET_length = 5000" >> user-config.py + echo "console_encoding = 'utf8'" >> user-config.py + echo "import os" >> user-config.py + echo "password_file = os.path.expanduser('passwordfile')" >> user-config.py + echo "('${{ env.PYWIKIBOT_USERNAME }}', '${{ secrets.PWD }}')" > passwordfile + + - name: Test with unittest + timeout-minutes: 10 + run: | + python pwb.py wikiupdater