Auto-open PR to main when CI passes on dev
Some checks failed
CI / Lint (ruff) (push) Successful in 13s
CI / Test (pytest) (3.11) (push) Successful in 19s
CI / Test (pytest) (3.12) (push) Successful in 20s
Security / SAST (bandit) (push) Successful in 12s
CI / Open PR to main (push) Has been cancelled
Security / Dependency audit (pip-audit) (push) Successful in 18s

This commit is contained in:
2026-04-04 17:42:42 -03:00
parent 6a5c6f098e
commit cf36ebcd84

View File

@@ -29,3 +29,30 @@ jobs:
python-version: ${{ matrix.python-version }} python-version: ${{ matrix.python-version }}
- run: pip install -e . - run: pip install -e .
- run: pytest tests/ -v --tb=short - run: pytest tests/ -v --tb=short
open-pr:
name: Open PR to main
runs-on: ubuntu-latest
needs: [lint, test]
if: github.ref == 'refs/heads/dev'
steps:
- name: Open PR via Gitea API
run: |
EXISTING=$(curl -s \
-H "Authorization: token ${{ secrets.DECNET_PR_TOKEN }}" \
"https://git.resacachile.cl/api/v1/repos/anti/DECNET/pulls?state=open&head=dev&base=main" \
| python3 -c "import sys, json; print(len(json.load(sys.stdin)))")
if [ "$EXISTING" -gt "0" ]; then
echo "PR already open, skipping."
exit 0
fi
curl -s -X POST \
-H "Authorization: token ${{ secrets.DECNET_PR_TOKEN }}" \
-H "Content-Type: application/json" \
-d '{
"title": "Auto PR: dev → main",
"head": "dev",
"base": "main",
"body": "All CI checks passed. Review and merge when ready."
}' \
"https://git.resacachile.cl/api/v1/repos/anti/DECNET/pulls"