Merge pull request 'auto: PR for feat/exporter-seo-perf' (#6) from feat/exporter-seo-perf into main
CI / test (push) Successful in 45s
CI / test (push) Successful in 45s
This commit was merged in pull request #6.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
name: Auto PR
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'feat/**'
|
||||
|
||||
jobs:
|
||||
open-pr:
|
||||
runs-on: [macos, host]
|
||||
steps:
|
||||
- name: Create Pull Request via Gitea API
|
||||
env:
|
||||
CI_TOKEN: ${{ secrets.CI_TOKEN }}
|
||||
GITEA_BASE_URL: https://gitea.jaybe.dev
|
||||
REPO: ${{ github.repository }}
|
||||
HEAD_BRANCH: ${{ github.ref_name }}
|
||||
BASE_BRANCH: main
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -z "${CI_TOKEN:-}" ]; then
|
||||
echo "GITEA_TOKEN not set; skipping auto-pr"; exit 0; fi
|
||||
OWNER=$(echo "$REPO" | cut -d'/' -f1)
|
||||
NAME=$(echo "$REPO" | cut -d'/' -f2)
|
||||
TITLE="auto: PR for $HEAD_BRANCH"
|
||||
BODY="Automated PR created on push to $HEAD_BRANCH"
|
||||
echo "Creating PR $HEAD_BRANCH -> $BASE_BRANCH for $OWNER/$NAME"
|
||||
HTTP_CODE=$(curl -sS -o /tmp/pr_resp.json -w "%{http_code}" -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: token ${CI_TOKEN}" \
|
||||
"${GITEA_BASE_URL}/api/v1/repos/${OWNER}/${NAME}/pulls" \
|
||||
-d "{\"head\":\"${HEAD_BRANCH}\",\"base\":\"${BASE_BRANCH}\",\"title\":\"${TITLE}\",\"body\":\"${BODY}\"}") || true
|
||||
echo "API status: $HTTP_CODE"
|
||||
if [ "$HTTP_CODE" = "201" ]; then
|
||||
echo "PR created"; cat /tmp/pr_resp.json
|
||||
else
|
||||
echo "PR not created (possibly exists). Response:"; cat /tmp/pr_resp.json || true
|
||||
fi
|
||||
@@ -42,3 +42,24 @@ jobs:
|
||||
path: playwright-report
|
||||
if-no-files-found: ignore
|
||||
retention-days: 3
|
||||
|
||||
- name: Auto-merge PR on green
|
||||
if: ${{ github.event_name == 'pull_request' }}
|
||||
env:
|
||||
CI_TOKEN: ${{ secrets.CI_TOKEN }}
|
||||
GITEA_BASE_URL: https://gitea.jaybe.dev
|
||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||
REPO: ${{ github.repository }}
|
||||
run: |
|
||||
set -euo pipefail
|
||||
if [ -z "${CI_TOKEN:-}" ]; then
|
||||
echo "CI_TOKEN not set; skipping auto-merge"; exit 0; fi
|
||||
OWNER=$(echo "$REPO" | cut -d'/' -f1)
|
||||
NAME=$(echo "$REPO" | cut -d'/' -f2)
|
||||
echo "Merging PR #$PR_NUMBER for $OWNER/$NAME"
|
||||
RESP=$(curl -sS -X POST \
|
||||
-H "Content-Type: application/json" \
|
||||
-H "Authorization: token ${CI_TOKEN}" \
|
||||
"${GITEA_BASE_URL}/api/v1/repos/${OWNER}/${NAME}/pulls/${PR_NUMBER}/merge" \
|
||||
-d '{"Do":"merge","MergeMessage":"auto-merge: CI green"}' || true)
|
||||
echo "API response: $RESP"
|
||||
|
||||
Reference in New Issue
Block a user