Skip to content

Commit efc2c1a

Browse files
committed
Draft workflow to open API refs PR
1 parent 405e825 commit efc2c1a

File tree

1 file changed

+54
-0
lines changed

1 file changed

+54
-0
lines changed

.github/workflows/api_refs.yaml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
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+
30+
- name: Build API Refs
31+
# TODO: On 5.0, update tool to handle both PHP & REST APIs
32+
# TODO: Composer auth?
33+
run: tools/php_api_ref/phpdoc.sh
34+
35+
- name: Commit and push
36+
run: |
37+
git checkout ${{ steps.version_and_branches.outputs.work_branch }}
38+
git add docs/api/php_api/php_api_reference/ tools/php_api_ref/.phpdoc/template/package-edition-map.twig
39+
#TODO: Set a user?
40+
git commit -m "PHP API Ref HTML"
41+
#TODO: git add doc/api/rest_api/rest_api_reference/rest_api_reference.html
42+
#TODO: git commit -m "REST API Ref HTML"
43+
#TODO: permission to push? Use an action? https://github.com/marketplace/actions/github-push
44+
git push
45+
46+
- name: Create Pull Request
47+
uses: peter-evans/create-pull-request@v3
48+
with:
49+
#TODO: token: ${{ ? }}
50+
title: "PHP API Ref ${{ steps.version_and_branches.outputs.version }}"
51+
body: "PHP API Reference update for ${{ steps.version_and_branches.outputs.version }}"
52+
branch: "${{ steps.version_and_branches.outputs.work_branch }}"
53+
base: "${{ steps.version_and_branches.outputs.base_branch }}"
54+
draft: false

0 commit comments

Comments
 (0)