41 lines
1.3 KiB
YAML
41 lines
1.3 KiB
YAML
name: Sync release into develop
|
|
|
|
on:
|
|
pull_request:
|
|
types:
|
|
- closed
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
sync-develop:
|
|
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: https://github.com/actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
token: ${{ secrets.RELEASE_TOKEN }}
|
|
|
|
- name: Install curl
|
|
run: apk add --no-cache curl
|
|
|
|
- name: Create PR main → develop
|
|
run: |
|
|
RELEASE_BRANCH="${{ github.event.pull_request.head.ref }}"
|
|
|
|
STATUS=$(curl -s -o /tmp/pr_response.json -w "%{http_code}" -X POST \
|
|
-H "Authorization: token ${{ secrets.RELEASE_TOKEN }}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"title\": \"chore: sync ${RELEASE_BRANCH} into develop\",
|
|
\"head\": \"main\",
|
|
\"base\": \"develop\",
|
|
\"body\": \"Synchronisation automatique après merge de ${RELEASE_BRANCH} dans main.\"
|
|
}" \
|
|
"https://git.goutailler-olivier.com/api/v1/repos/${{ gitea.repository }}/pulls")
|
|
echo "POST /pulls → HTTP $STATUS"
|
|
cat /tmp/pr_response.json
|
|
[ "$STATUS" = "201" ] || exit 1
|