fix(workflow): do not modify and commit the toml version, publish wit… #4
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
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@v4 | |
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 }} |