forked from onemoola/newspy
-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (52 loc) · 1.73 KB
/
main.yml
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
name: Main
on:
push:
branches:
- main
jobs:
test:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: 3.13
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.8.4
virtualenvs-create: true
virtualenvs-in-project: true
installer-parallel: true
- name: Install dependencies
run: poetry install --no-interaction --no-root
- name: Install project
run: poetry install --no-interaction
- name: Run tests
run: |
source $VENV
pytest tests --exitfirst --verbose --failed-first --cov-report term --cov-report xml:coverage.xml --cov=newspy
- name: Upload coverage to Codecov
uses: codecov/codecov-action@v5
continue-on-error: true
with:
fail_ci_if_error: true
files: ./coverage.xml
verbose: true
- name: Create Pull Request (if none exists)
run: |
existing_pr=$(gh pr list --base release --head main --search "Merge main into release" --state open --limit 1)
if [ -z "$existing_pr" ]; then
echo "No existing PR found. Creating a new one."
gh pr create --title "Merge main into release" --body "This PR merges changes from the main branch into the release branch." --base release --head main
else
echo "Pull Request already exists. Skipping creation."
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}