|
14 | 14 | - '.github/**' |
15 | 15 |
|
16 | 16 | jobs: |
17 | | - # Generate api data |
18 | | - generate-api-data: |
19 | | - if: "!contains(github.event.head_commit.message, 'Update autogenerated JSON files')" |
20 | | - runs-on: ubuntu-latest |
21 | | - # Permissions needed to create PR and write content |
22 | | - permissions: |
23 | | - contents: write |
24 | | - pull-requests: write |
25 | | - |
26 | | - steps: |
27 | | - - name: Checkout code |
28 | | - uses: actions/checkout@v4 |
29 | | - with: |
30 | | - token: ${{ secrets.GITHUB_TOKEN }} |
31 | | - |
32 | | - - name: Use Node.js v20.x |
33 | | - uses: actions/setup-node@v4 |
34 | | - with: |
35 | | - node-version: 20.x |
36 | | - registry-url: 'https://registry.npmjs.org' |
37 | | - |
38 | | - - name: Install dependencies |
39 | | - run: npm ci |
40 | | - |
41 | | - - name: Generate API data |
42 | | - working-directory: ./projects/composition |
43 | | - run: | |
44 | | - npm run generate-json-api |
45 | | -
|
46 | | - # Instead of direct commit/push, create a PR |
47 | | - - name: Create Pull Request |
48 | | - id: cpr |
49 | | - uses: peter-evans/create-pull-request@v6 |
50 | | - with: |
51 | | - token: ${{ secrets.GITHUB_TOKEN }} |
52 | | - # More descriptive commit message |
53 | | - commit-message: 'chore: Update API documentation JSON files' |
54 | | - # Use bot account for better tracking |
55 | | - committer: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
56 | | - author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
57 | | - # Unique branch name using run number to avoid conflicts |
58 | | - branch: api-docs-update-${{ github.run_number }} |
59 | | - # Auto-delete branch after merge |
60 | | - delete-branch: true |
61 | | - title: 'chore: Update API documentation JSON files' |
62 | | - # Detailed PR description with context |
63 | | - body: | |
64 | | - ## Auto-generated API Documentation Update |
65 | | -
|
66 | | - This PR contains automatically generated API documentation files. |
67 | | -
|
68 | | - ### Changes |
69 | | - - Updated JSON API files based on latest component changes |
70 | | -
|
71 | | - ### Workflow Run |
72 | | - - Triggered by commit: ${{ github.sha }} |
73 | | - - Run ID: ${{ github.run_id }} |
74 | | -
|
75 | | - --- |
76 | | -
|
77 | | - 🤖 This PR was automatically created by the documentation workflow. |
78 | | - # Labels for organization and to skip changelog |
79 | | - labels: | |
80 | | - documentation |
81 | | - automated |
82 | | - skip-changelog |
83 | | -
|
84 | | - # Auto-merge the PR (requires repo settings to allow auto-merge) |
85 | | - - name: Enable Pull Request Automerge |
86 | | - if: steps.cpr.outputs.pull-request-operation == 'created' |
87 | | - uses: peter-evans/enable-pull-request-automerge@v3 |
88 | | - with: |
89 | | - token: ${{ secrets.GITHUB_TOKEN }} |
90 | | - pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} |
91 | | - merge-method: squash |
92 | | - |
93 | | - # Auto-approve the PR so it can be merged |
94 | | - - name: Auto approve PR |
95 | | - if: steps.cpr.outputs.pull-request-operation == 'created' |
96 | | - uses: hmarr/auto-approve-action@v4 |
97 | | - with: |
98 | | - github-token: ${{ secrets.GITHUB_TOKEN }} |
99 | | - pull-request-number: ${{ steps.cpr.outputs.pull-request-number }} |
100 | | - |
101 | 17 | # Build job |
102 | 18 | build: |
103 | 19 | runs-on: ubuntu-latest |
104 | | - needs: generate-api-data |
105 | | - # Only run if generate-api-data succeeded or was skipped (not failed) |
106 | | - if: always() && (needs.generate-api-data.result == 'success' || needs.generate-api-data.result == 'skipped') |
107 | 20 |
|
108 | 21 | steps: |
109 | 22 | - name: Checkout code |
|
0 commit comments