77 description : " PR number in apify/apify-docs that triggered this workflow"
88 required : true
99 type : string
10- docs_pr_branch :
11- description : " Branch name in apify/apify-docs PR"
10+ docs_pr_sha :
11+ description : " Commit SHA from the apify/apify-docs PR"
1212 required : true
1313 type : string
1414
15+ permissions :
16+ contents : write
17+ pull-requests : write
18+
1519concurrency :
1620 group : regenerate-models-${{ inputs.docs_pr_number }}
1721 cancel-in-progress : true
@@ -25,11 +29,11 @@ jobs:
2529 - name : Checkout apify-client-python
2630 uses : actions/checkout@v6
2731
28- - name : Checkout apify-docs at PR branch
32+ - name : Checkout apify-docs at PR commit
2933 uses : actions/checkout@v6
3034 with :
3135 repository : apify/apify-docs
32- ref : ${{ inputs.docs_pr_branch }}
36+ ref : ${{ inputs.docs_pr_sha }}
3337 path : apify-docs
3438 token : ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
3539
@@ -115,12 +119,27 @@ jobs:
115119 GITHUB_TOKEN : ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
116120
117121 - name : Comment on apify-docs PR
118- if : steps.changes.outputs.changed == 'true' && steps.pr.outputs.created == 'true'
122+ if : steps.changes.outputs.changed == 'true'
123+ env :
124+ GITHUB_TOKEN : ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
119125 run : |
126+ if [ "${{ steps.pr.outputs.created }}" = "true" ]; then
127+ COMMENT="A PR to update the Python client models has been created: ${{ steps.pr.outputs.pr_url }}
128+
129+ This was automatically triggered by OpenAPI specification changes in this PR."
130+ else
131+ COMMENT="The Python client model PR has been updated with the latest OpenAPI spec changes: ${{ steps.pr.outputs.pr_url }}"
132+ fi
133+
120134 gh pr comment "${{ inputs.docs_pr_number }}" \
121135 --repo apify/apify-docs \
122- --body "A PR to update the Python client models has been created in apify-client-python: ${{ steps.pr.outputs.pr_url }}
136+ --body "$COMMENT"
123137
124- This was automatically triggered by OpenAPI specification changes in this PR."
138+ - name : Comment on failure
139+ if : failure()
125140 env :
126141 GITHUB_TOKEN : ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }}
142+ run : |
143+ gh pr comment "${{ inputs.docs_pr_number }}" \
144+ --repo apify/apify-docs \
145+ --body "Python client model regeneration failed. [See workflow run](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})."
0 commit comments