Skip to content

Commit 6101dfe

Browse files
authored
IBX-9904: Workflow to build API refs into new PR (#2723)
* Draft workflow to open API refs PR * api_refs.yaml: checkout the right branch before forking a new one. * api_refs.yaml: dummy triggers to register workflow * Revert "api_refs.yaml: dummy triggers to register workflow" This reverts commit 530cb71. * api_refs.yaml: Fix base_branch parsing * api_refs.yaml: Fix new branch creation * api_refs.yaml: Set a Git user Switched to a new branch 'api_refs_v4.6.x' Author identity unknown *** Please tell me who you are. Run git config --global user.email "[email protected]" git config --global user.name "Your Name" to set your account's default identity. Omit --global to set the identity only in this repository. * api_refs.yaml: Fix branch push fatal: The current branch api_refs_v4.6.x has no upstream branch. To push the current branch and set the remote as upstream, use git push --set-upstream origin api_refs_v4.6.x * api_refs.yaml: Fix branch push * api_refs.yaml: Fix branch push and PR create * api_refs.yaml: Fix branch push and PR create * api_refs.yaml: Composer authentication * api_refs.yaml: Composer authentication * api_refs.yaml: Enh. PHP performance Disable xdebug - https://github.com/actions/runner-images/blob/ubuntu24/20250504.1/images/ubuntu/Ubuntu2404-Readme.md#php-tools - https://github.com/marketplace/actions/setup-php-action#xdebug - https://github.com/marketplace/actions/setup-php-action#disable-coverage * api_refs.yaml: Prepare PR state and labels * api_refs.yaml: Try to debug the \E issue * api_refs.yaml: Try to debug the \E issue * api_refs.yaml: Try to debug the \E issue * api_refs.yaml: Try to debug the \E issue * api_refs.yaml: Try to fix the \E issue * api_refs.yaml: Try to fix the \E issue * Revert "api_refs.yaml: Try to fix the \E issue" This reverts commit 16fd5be. * api_refs.yaml: Try to fix the \E issue * api_refs.yaml: Clean-up after debug * api_refs.yaml: Try to trigger PR workflows peter-evans/create-pull-request#48 (comment) * api_refs.yaml: Try to trigger PR workflows peter-evans/create-pull-request#48 (comment) * api_refs.yaml: Try to trigger PR workflows https://github.com/peter-evans/create-pull-request?tab=readme-ov-file#token https://github.com/peter-evans/create-pull-request/blob/main/docs/concepts-guidelines.md#triggering-further-workflow-runs * api_refs.yaml: Set prod conf back
1 parent ab038d5 commit 6101dfe

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed

.github/workflows/api_refs.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: 'Build API Refs'
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Released version'
8+
required: true
9+
type: string
10+
11+
jobs:
12+
open_php_api_ref_pr:
13+
name: "PHP & REST API References' PR"
14+
runs-on: ubuntu-latest
15+
16+
steps:
17+
- name: Set version and branches
18+
id: version_and_branches
19+
run: |
20+
version="${{ inputs.version }}"
21+
base_branch="$(echo $version | sed 's/v\(.*\..*\)\..*/\1/')"
22+
work_branch="api_refs_$version"
23+
echo "version=$version" >> "$GITHUB_OUTPUT"
24+
echo "base_branch=$base_branch" >> "$GITHUB_OUTPUT"
25+
echo "work_branch=$work_branch" >> "$GITHUB_OUTPUT"
26+
27+
- name: Checkout documentation
28+
uses: actions/checkout@v4
29+
with:
30+
ref: ${{ steps.version_and_branches.outputs.base_branch }}
31+
32+
- name: Disable PHP coverage
33+
uses: shivammathur/setup-php@v2
34+
with:
35+
coverage: none
36+
37+
- name: Build API Refs
38+
env:
39+
SATIS_NETWORK_KEY: ${{ secrets.SATIS_NETWORK_KEY }}
40+
SATIS_NETWORK_TOKEN: ${{ secrets.SATIS_NETWORK_TOKEN }}
41+
run: |
42+
composer config --global http-basic.updates.ibexa.co $SATIS_NETWORK_KEY $SATIS_NETWORK_TOKEN
43+
#TODO: On 5.0, update tool to handle both PHP & REST APIs
44+
tools/php_api_ref/phpdoc.sh
45+
# Fix escape character:
46+
perl -pi -e 's/\e/\\E/g' tools/php_api_ref/.phpdoc/template/package-edition-map.twig
47+
48+
- name: Commit
49+
run: |
50+
git config --global user.name "${GITHUB_ACTOR}"
51+
git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com"
52+
git add docs/api/php_api/php_api_reference/ tools/php_api_ref/.phpdoc/template/package-edition-map.twig
53+
git commit -m "PHP API Ref HTML"
54+
#TODO: git add doc/api/rest_api/rest_api_reference/rest_api_reference.html
55+
#TODO: git commit -m "REST API Ref HTML"
56+
57+
- name: Create Pull Request
58+
uses: peter-evans/create-pull-request@v7
59+
with:
60+
token: ${{ secrets.EZROBOT_PAT }}
61+
title: "PHP API Ref ${{ steps.version_and_branches.outputs.version }}"
62+
body: "PHP API Reference update for ${{ steps.version_and_branches.outputs.version }}"
63+
branch: "${{ steps.version_and_branches.outputs.work_branch }}"
64+
base: "${{ steps.version_and_branches.outputs.base_branch }}"
65+
draft: false
66+
labels: 'Needs DOC review'

0 commit comments

Comments
 (0)