Implemented the full clean rewrite for Gitea
This commit is contained in:
48
.gitea/workflows/check.yml
Normal file
48
.gitea/workflows/check.yml
Normal file
@@ -0,0 +1,48 @@
|
||||
name: Hourly blackout check
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: "@hourly"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: https://gitea.com/actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Set up Python
|
||||
uses: https://gitea.com/actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.13"
|
||||
|
||||
- name: Install project
|
||||
run: python -m pip install .
|
||||
|
||||
- name: Check outages and persist state
|
||||
env:
|
||||
BARGHEMAN_TOKEN: ${{ secrets.BARGHEMAN_TOKEN }}
|
||||
EITAAYAR_TOKEN: ${{ secrets.EITAAYAR_TOKEN }}
|
||||
CHAT_ID: ${{ secrets.CHAT_ID }}
|
||||
BILL_IDS: ${{ secrets.BILL_IDS }}
|
||||
STATE_FILE: state/outages.json
|
||||
run: |
|
||||
set +e
|
||||
python -m blackout_notifier check
|
||||
checker_status=$?
|
||||
set -e
|
||||
|
||||
if ! git diff --quiet -- state/outages.json; then
|
||||
git config user.name "gitea-blackout-bot"
|
||||
git config user.email "blackout-bot@mahgit.ir"
|
||||
git add state/outages.json
|
||||
git commit -m "chore(state): update outage notification state [skip ci]"
|
||||
branch="$(git branch --show-current)"
|
||||
git pull --rebase origin "$branch"
|
||||
git push origin "$branch"
|
||||
fi
|
||||
|
||||
exit "$checker_status"
|
||||
32
.gitea/workflows/test.yml
Normal file
32
.gitea/workflows/test.yml
Normal file
@@ -0,0 +1,32 @@
|
||||
name: Test blackout notifier
|
||||
|
||||
on:
|
||||
push:
|
||||
paths-ignore:
|
||||
- state/outages.json
|
||||
pull_request:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out repository
|
||||
uses: https://gitea.com/actions/checkout@v4
|
||||
|
||||
- name: Set up Python
|
||||
uses: https://gitea.com/actions/setup-python@v5
|
||||
with:
|
||||
python-version: "3.13"
|
||||
|
||||
- name: Install project
|
||||
run: python -m pip install -e '.[test]'
|
||||
|
||||
- name: Lint
|
||||
run: ruff check .
|
||||
|
||||
- name: Check formatting
|
||||
run: ruff format --check .
|
||||
|
||||
- name: Test
|
||||
run: pytest
|
||||
Reference in New Issue
Block a user