-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 1ec113f
Showing
34 changed files
with
521 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
version: 2 | ||
updates: | ||
- package-ecosystem: "github-actions" | ||
directory: "/" | ||
groups: | ||
dependencies: | ||
patterns: | ||
- "*" | ||
labels: | ||
- "ci" | ||
schedule: | ||
interval: "monthly" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Update | ||
on: | ||
workflow_dispatch: | ||
jobs: | ||
update: | ||
name: Update | ||
permissions: | ||
contents: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
submodules: recursive | ||
- name: update submodules | ||
run: | | ||
git config user.name github-actions[bot] | ||
git config user.email github-actions[bot]@users.noreply.github.com | ||
git submodule sync --recursive | ||
git submodule update --init --no-single-branch --remote --recursive | ||
git commit -am "update submodules" || echo no updates | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[submodule "bsiconsbot"] | ||
path = bsiconsbot | ||
url = https://github.com/jjmc89-bot/bsiconsbot | ||
branch = main | ||
[submodule "jjmc89-bot-scripts"] | ||
path = jjmc89-bot-scripts | ||
url = https://github.com/jjmc89-bot/jjmc89-bot-scripts | ||
branch = main | ||
[submodule "pywikibot"] | ||
path = pywikibot | ||
url = https://gerrit.wikimedia.org/r/pywikibot/core | ||
branch = stable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
repos: | ||
- repo: meta | ||
hooks: | ||
- id: check-hooks-apply | ||
- id: check-useless-excludes | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.6.0 | ||
hooks: | ||
- id: check-added-large-files | ||
- id: check-case-conflict | ||
- id: check-executables-have-shebangs | ||
- id: check-merge-conflict | ||
- id: check-shebang-scripts-are-executable | ||
- id: check-vcs-permalinks | ||
- id: check-yaml | ||
- id: destroyed-symlinks | ||
- id: end-of-file-fixer | ||
- id: fix-byte-order-marker | ||
- id: mixed-line-ending | ||
- id: trailing-whitespace | ||
- repo: https://github.com/jumanjihouse/pre-commit-hooks | ||
rev: 3.0.0 | ||
hooks: | ||
- id: script-must-not-have-extension | ||
- repo: https://github.com/lovesegfault/beautysh | ||
rev: v6.2.1 | ||
hooks: | ||
- id: beautysh | ||
additional_dependencies: | ||
- setuptools # depends on pkg_resources | ||
- repo: https://github.com/shellcheck-py/shellcheck-py | ||
rev: v0.10.0.1 | ||
hooks: | ||
- id: shellcheck |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
disable=SC1091 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2021-2022 JJMC89 | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
[](https://results.pre-commit.ci/latest/github/jjmc89-bot/jjmc89-bot-toolforge/main) | ||
|
||
[JJMC89 bot](https://meta.wikimedia.org/wiki/User:JJMC89_bot), [JJMC89 bot II](https://meta.wikimedia.org/wiki/User:JJMC89_bot_II), [JJMC89 bot III](https://meta.wikimedia.org/wiki/User:JJMC89_bot_III), and [Magic links bot](https://meta.wikimedia.org/wiki/User:Magic_links_bot) run on [Wikimedia](https://www.wikimedia.org/) projects and are hosted on [Wikimedia Toolforge](https://toolforge.org/). | ||
|
||
Toolforge setup and job management | ||
|
||
## Clone and setup virtual environments | ||
```shell | ||
rm -fdr $HOME/repos && git clone --depth 1 --single-branch --recurse-submodules --shallow-submodules https://github.com/jjmc89-bot/jjmc89-bot-toolforge $HOME/repos && toolforge-jobs run setup-venvs --command $HOME/repos/bin/setup-venvs --image python3.11 --wait | ||
``` | ||
|
||
## Load jobs | ||
```shell | ||
toolforge-jobs load $HOME/repos/cronjobs.yaml | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/bash | ||
# shellcheck disable=SC1090 | ||
set -euo pipefail | ||
|
||
VENVPYZ=$HOME/virtualenv.pyz | ||
|
||
mkdir -p "$HOME/repos/.venvs" | ||
|
||
curl --silent --location --output "$VENVPYZ" https://bootstrap.pypa.io/virtualenv/3.11/virtualenv.pyz | ||
|
||
function setup-venv { | ||
echo "Setting up $1" | ||
rm -fdr "$HOME/repos/.venvs/$1" | ||
python3 "$VENVPYZ" "$HOME/repos/.venvs/$1" | ||
. "$HOME/repos/.venvs/$1/bin/activate" | ||
python3 -m pip install -U pip setuptools wheel | ||
# shellcheck disable=SC2086 | ||
python3 -m pip install $2 | ||
deactivate | ||
} | ||
|
||
setup-venv jjmc89-bot-scripts "-U -r $HOME/repos/jjmc89-bot-scripts/requirements.txt" | ||
setup-venv bsiconsbot "-e $HOME/repos/bsiconsbot" | ||
setup-venv pwb "-e $HOME/repos/pywikibot[mwoauth,mysql]" |
Submodule bsiconsbot
added at
f548c5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
- &defaults | ||
name: dummy-defaults-job | ||
command: echo this is a dummy job to set defaults | ||
emails: onfailure | ||
image: python3.11 | ||
no-filelog: true | ||
retry: 5 | ||
- name: admin-activity-early | ||
command: $HOME/repos/jobs/admin-activity | ||
schedule: '7 0 1-28 * *' | ||
<<: *defaults | ||
- name: admin-activity-late | ||
command: $HOME/repos/jobs/admin-activity | ||
schedule: '53 23 28-31 * *' | ||
retry: 1 | ||
<<: *defaults | ||
- name: bsicons-replacer | ||
command: $HOME/repos/jobs/bsicons-replacer | ||
mem: 1Gi | ||
schedule: '7 7 * * *' | ||
<<: *defaults | ||
- name: bsicons-reporter | ||
command: $HOME/repos/jobs/bsicons-reporter | ||
schedule: '12 12 * * *' | ||
<<: *defaults | ||
- name: cat-dbl-redir-fixer | ||
command: $HOME/repos/jobs/cat-dbl-redir-fixer | ||
schedule: '6 6 * * 6' | ||
<<: *defaults | ||
- name: cfdw | ||
command: $HOME/repos/jobs/cfdw | ||
schedule: '17,47 * * * *' | ||
<<: *defaults | ||
- name: cfdwl | ||
command: $HOME/repos/jobs/cfdwl | ||
schedule: '37 */3 * * *' | ||
<<: *defaults | ||
- name: commons-potd-importer | ||
command: $HOME/repos/jobs/commons-potd-importer | ||
schedule: '7 0 * * *' | ||
<<: *defaults | ||
- name: dfy-daily | ||
command: $HOME/repos/jobs/dfy-daily | ||
schedule: '17 1 * * *' | ||
<<: *defaults | ||
- name: dfy-monthly | ||
command: $HOME/repos/jobs/dfy-monthly | ||
schedule: '37 1 1 * *' | ||
<<: *defaults | ||
- name: dfy-tagger | ||
command: $HOME/repos/jobs/dfy-tagger | ||
schedule: '*/5 * * * *' | ||
<<: *defaults | ||
- name: dfy-untagger | ||
command: $HOME/repos/jobs/dfy-untagger | ||
schedule: '57 23 * * *' | ||
<<: *defaults | ||
- name: dfy-weekly | ||
command: $HOME/repos/jobs/dfy-weekly | ||
schedule: '27 1 * * 0' | ||
<<: *defaults | ||
- name: inactive-interface-admins | ||
command: $HOME/repos/jobs/inactive-interface-admins | ||
schedule: '18 23 28 * *' | ||
<<: *defaults | ||
- name: infotalk-editnotice | ||
command: $HOME/repos/jobs/infotalk-editnotice | ||
schedule: '7 19 * * *' | ||
<<: *defaults | ||
- name: massmessage-list-updater | ||
command: $HOME/repos/jobs/massmessage-list-updater | ||
schedule: '13 0 * * *' | ||
<<: *defaults | ||
- name: mlr-daily | ||
command: $HOME/repos/jobs/mlr-daily | ||
schedule: '16 16 * * *' | ||
<<: *defaults | ||
- name: purge-daily | ||
command: $HOME/repos/jobs/purge-daily | ||
schedule: '0 1 * * *' | ||
<<: *defaults | ||
- name: purge-dup-args | ||
command: $HOME/repos/jobs/purge-dup-args | ||
schedule: '33 * * * *' | ||
<<: *defaults | ||
- name: purge-script-errors-ns0 | ||
command: $HOME/repos/jobs/purge-script-errors-ns0 | ||
schedule: '4 * * * *' | ||
<<: *defaults | ||
- name: purge-weekly | ||
command: $HOME/repos/jobs/purge-weekly | ||
schedule: '27 1 * * 1' | ||
<<: *defaults | ||
- name: svg-validator-daily | ||
command: $HOME/repos/jobs/svg-validator-daily | ||
schedule: '2 2 * * *' | ||
<<: *defaults | ||
- name: svg-validator-monthly | ||
command: $HOME/repos/jobs/svg-validator-monthly | ||
schedule: '3 3 28 * *' | ||
<<: *defaults |
Submodule jjmc89-bot-scripts
added at
7c018b
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
. "$HOME"/repos/.venvs/jjmc89-bot-scripts/bin/activate | ||
|
||
day=$(date -u +"%d") | ||
|
||
if [ "$day" = "01" ]; then | ||
args=(--notify c1n1 --notify c2 --notify c2r) | ||
elif [ "$day" = "23" ]; then | ||
args=(--update-recent --notify c1n2) | ||
else | ||
args=(--update-recent) | ||
fi | ||
|
||
python3 "$HOME"/repos/jjmc89-bot-scripts/enwiki/admin_activity.py -dir:.pywikibot-admin-activity "${args[@]}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
. "$HOME"/repos/.venvs/bsiconsbot/bin/activate | ||
|
||
if [ "$(date +"%u")" -eq 6 ]; then | ||
tpl='--transcluded' | ||
else | ||
tpl='' | ||
fi | ||
|
||
# shellcheck disable=SC2086 | ||
bsicons-replacer \ | ||
-lang:commons -family:commons \ | ||
-ns:not:2,3 \ | ||
User:JJMC89_bot/config/BSiconsReplacer/global \ | ||
--local-config User:JJMC89_bot/config/BSiconsReplacer \ | ||
--always \ | ||
$tpl |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
. "$HOME"/repos/.venvs/bsiconsbot/bin/activate | ||
|
||
bsicons-reporter \ | ||
-lang:commons -family:commons \ | ||
User:JJMC89_bot/config/BSicons \ | ||
User:JJMC89_bot/report/BSicons/changes \ | ||
User:JJMC89_bot/report/BSicons/large \ | ||
User:JJMC89_bot/report/BSicons/logs \ | ||
User:JJMC89_bot/report/BSicons/redirects |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
. "$HOME"/repos/.venvs/jjmc89-bot-scripts/bin/activate | ||
|
||
python3 "$HOME"/repos/jjmc89-bot-scripts/enwiki/category_double_redirect_fixer.py \ | ||
-ns:14 \ | ||
-transcludes:'Category redirect' \ | ||
--always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
. "$HOME"/repos/.venvs/jjmc89-bot-scripts/bin/activate | ||
|
||
python3 "$HOME"/repos/jjmc89-bot-scripts/enwiki/cfdw.py \ | ||
-dir:"$HOME"/.pywikibot-cfdw \ | ||
-page:WP:Categories_for_discussion/Working |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
. "$HOME"/repos/.venvs/jjmc89-bot-scripts/bin/activate | ||
|
||
python3 "$HOME"/repos/jjmc89-bot-scripts/enwiki/cfdw.py \ | ||
-dir:"$HOME"/.pywikibot-cfdwl \ | ||
-page:WP:Categories_for_discussion/Working/Large |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
# shellcheck disable=SC2086 | ||
set -euo pipefail | ||
|
||
. "$HOME"/repos/.venvs/jjmc89-bot-scripts/bin/activate | ||
|
||
python3 "$HOME"/repos/jjmc89-bot-scripts/multi/commons_potd_importer.py --always \ | ||
-page:'User:JJMC89 bot/Commons picture of the day' \ | ||
-page:'eu:User:JJMC89 bot/Commons eguneko irudia' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
. "$HOME"/repos/.venvs/jjmc89-bot-scripts/bin/activate | ||
|
||
python3 "$HOME"/repos/jjmc89-bot-scripts/enwiki/draftification_report.py \ | ||
'User:JJMC89 bot/report/Draftifications/daily' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
. "$HOME"/repos/.venvs/jjmc89-bot-scripts/bin/activate | ||
|
||
python3 "$HOME"/repos/jjmc89-bot-scripts/enwiki/draftification_report.py \ | ||
'User:JJMC89 bot/report/Draftifications/monthly' \ | ||
--start "$(date -ud "-1 month" +"%Y-%m-%dT00:00:00Z")" \ | ||
--end "$(date -u +"%Y-%m-%dT00:00:00Z")" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
. "$HOME"/repos/.venvs/jjmc89-bot-scripts/bin/activate | ||
|
||
python3 "$HOME"/repos/jjmc89-bot-scripts/enwiki/draftification_tagger.py \ | ||
-dir:"$HOME"/.pywikibot-dfy-tagger \ | ||
--always \ | ||
--start "$(date -ud '-15 min' +"%Y-%m-%dT%H:%M:%SZ")" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
. "$HOME"/repos/.venvs/pwb/bin/activate | ||
|
||
python3 "$HOME"/repos/pywikibot/pwb.py \ | ||
template \ | ||
-dir:"$HOME"/.pywikibot-dfy-tagger \ | ||
-ns:0 \ | ||
'drafts moved from mainspace' \ | ||
-remove \ | ||
-summary:'Remove {{drafts moved from mainspace}}' \ | ||
-always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
set -euo pipefail | ||
|
||
. "$HOME"/repos/.venvs/jjmc89-bot-scripts/bin/activate | ||
|
||
python3 "$HOME"/repos/jjmc89-bot-scripts/enwiki/draftification_report.py \ | ||
'User:JJMC89 bot/report/Draftifications/weekly' \ | ||
--start "$(date -ud "-1 week" +"%Y-%m-%dT00:00:00Z")" \ | ||
--end "$(date -u +"%Y-%m-%dT00:00:00Z")" |
Oops, something went wrong.