forked from Polymarket/agents
-
Notifications
You must be signed in to change notification settings - Fork 0
92 lines (79 loc) · 2.62 KB
/
Copy pathbot-auto-pr.yml
File metadata and controls
92 lines (79 loc) · 2.62 KB
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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
name: Bot — Auto PRs (semi-automatic)
on:
push:
branches:
- 'bot/**'
schedule:
- cron: '0 2 * * *' # daily at 02:00 UTC
workflow_dispatch:
jobs:
test-and-lint:
name: Test & Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.10'
- name: Install dependencies (if any)
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
pip install black==23.12.0 flake8 pytest || true
- name: Run black (check)
run: |
if command -v black >/dev/null 2>&1; then
black --check . || true
fi
- name: Run flake8
run: |
if command -v flake8 >/dev/null 2>&1; then
flake8 || true
fi
- name: Run tests (pytest)
run: |
if command -v pytest >/dev/null 2>&1; then
pytest -q || true
fi
- name: Run linters (flake8 if present)
run: |
if command -v flake8 >/dev/null 2>&1; then
flake8 || true
fi
create-pr:
name: Create Pull Request
runs-on: ubuntu-latest
needs: test-and-lint
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Configure git for auto-commits
run: |
git config user.name "automation-bot"
git config user.email "automation-bot@users.noreply.github.com"
- name: Autoformat with black (if installed)
run: |
if python -c "import importlib.util,sys; sys.exit(0 if importlib.util.find_spec('black') else 1)"; then
python -m black . || true
git add -A
git diff --quiet --cached || (git commit -m "style: autoformat with black" || true)
fi
# This action will create a PR from branch `automation/bot-auto-pr` when changes exist.
- name: Create Pull Request (draft)
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: chore(ci): automated fixes / checks
branch: automation/bot-auto-pr
title: "chore(ci): automated bot PR"
body: |
This pull request was created automatically by the repository automation workflow.
It contains automated lint/test fixes or CI suggestions. Please review before merging.
labels: automated
draft: true