diff --git a/.github/workflows/manual_regenerate_models.yaml b/.github/workflows/manual_regenerate_models.yaml index 84cfde08..3db02257 100644 --- a/.github/workflows/manual_regenerate_models.yaml +++ b/.github/workflows/manual_regenerate_models.yaml @@ -104,19 +104,27 @@ jobs: uv run poe generate-models fi - - name: Commit and push model changes - id: commit - uses: EndBug/add-and-commit@v10 + - name: Stage model changes + id: stage + run: | + git add 'src/apify_client/_*_generated.py' + if git diff --cached --quiet; then + echo "has-changes=false" >> "$GITHUB_OUTPUT" + else + echo "has-changes=true" >> "$GITHUB_OUTPUT" + fi + + - name: Commit model changes + if: steps.stage.outputs.has-changes == 'true' + uses: apify/workflows/commit@v0.44.0 with: - add: 'src/apify_client/_*_generated.py' - author_name: apify-service-account - author_email: apify-service-account@users.noreply.github.com - message: ${{ env.TITLE }} - commit: --no-verify - push: -u origin ${{ env.BRANCH }} + commit-message: ${{ env.TITLE }} + github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} + branch: ${{ env.BRANCH }} + create-branch: 'true' - name: Create or update PR - if: steps.commit.outputs.committed == 'true' + if: steps.stage.outputs.has-changes == 'true' id: pr env: GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} @@ -150,7 +158,7 @@ jobs: # Post a cross-repo comment on the original docs PR so reviewers know about the corresponding client-python PR. - name: Comment on apify-docs PR - if: steps.commit.outputs.committed == 'true' && inputs.docs_pr_number + if: steps.stage.outputs.has-changes == 'true' && inputs.docs_pr_number env: GH_TOKEN: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} PR_CREATED: ${{ steps.pr.outputs.created }} diff --git a/.github/workflows/manual_release_beta.yaml b/.github/workflows/manual_release_beta.yaml index 5be9517e..6a7f8db2 100644 --- a/.github/workflows/manual_release_beta.yaml +++ b/.github/workflows/manual_release_beta.yaml @@ -72,7 +72,4 @@ jobs: pages: write id-token: write uses: ./.github/workflows/manual_release_docs.yaml - with: - # Use the ref from the changelog update to include the updated changelog. - ref: ${{ needs.changelog_update.outputs.changelog_commitish }} secrets: inherit diff --git a/.github/workflows/manual_release_docs.yaml b/.github/workflows/manual_release_docs.yaml index 4fe89f0c..9fa77615 100644 --- a/.github/workflows/manual_release_docs.yaml +++ b/.github/workflows/manual_release_docs.yaml @@ -6,11 +6,6 @@ on: # Runs when invoked by another workflow. workflow_call: - inputs: - ref: - description: Git ref to checkout. - required: true - type: string permissions: contents: read @@ -35,7 +30,6 @@ jobs: uses: actions/checkout@v6 with: token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} - ref: ${{ inputs.ref || github.event.repository.default_branch }} - name: Set up Node uses: actions/setup-node@v6 @@ -63,15 +57,23 @@ jobs: - name: Update docs theme run: uv run poe update-docs-theme + - name: Stage updated package.json and lockfile + id: stage + run: | + git pull --rebase --autostash + git add website/package.json website/pnpm-lock.yaml + if git diff --cached --quiet; then + echo "has-changes=false" >> "$GITHUB_OUTPUT" + else + echo "has-changes=true" >> "$GITHUB_OUTPUT" + fi + - name: Commit the updated package.json and lockfile - uses: EndBug/add-and-commit@v10 + if: steps.stage.outputs.has-changes == 'true' + uses: apify/workflows/commit@v0.44.0 with: - add: website/package.json website/pnpm-lock.yaml - message: "chore: Automatic docs theme update [skip ci]" - default_author: github_actions - pull: '--rebase --autostash' - # `actions/checkout` detaches HEAD on SHA refs; EndBug needs a branch to push. - new_branch: ${{ github.event.repository.default_branch }} + commit-message: "chore: Automatic docs theme update [skip ci]" + github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} - name: Build docs run: uv run poe build-docs diff --git a/.github/workflows/manual_release_stable.yaml b/.github/workflows/manual_release_stable.yaml index 9460e63e..c52d9371 100644 --- a/.github/workflows/manual_release_stable.yaml +++ b/.github/workflows/manual_release_stable.yaml @@ -108,9 +108,6 @@ jobs: permissions: contents: write uses: ./.github/workflows/manual_version_docs.yaml - with: - # Commit the version docs changes on top of the changelog commit. - ref: ${{ needs.changelog_update.outputs.changelog_commitish }} secrets: inherit doc_release: @@ -121,7 +118,4 @@ jobs: pages: write id-token: write uses: ./.github/workflows/manual_release_docs.yaml - with: - # Commit the docs release changes on top of the version docs commit. - ref: ${{ needs.version_docs.outputs.version_docs_commitish }} secrets: inherit diff --git a/.github/workflows/manual_version_docs.yaml b/.github/workflows/manual_version_docs.yaml index 3ba73695..5848166f 100644 --- a/.github/workflows/manual_version_docs.yaml +++ b/.github/workflows/manual_version_docs.yaml @@ -6,15 +6,6 @@ on: # Runs when invoked by another workflow. workflow_call: - inputs: - ref: - description: Git ref to checkout. - required: true - type: string - outputs: - version_docs_commitish: - description: The commit SHA of the versioned docs commit. - value: ${{ jobs.version_docs.outputs.version_docs_commitish }} concurrency: group: version-docs @@ -31,8 +22,6 @@ jobs: version_docs: name: Version docs runs-on: ubuntu-latest - outputs: - version_docs_commitish: ${{ steps.resolve_commitish.outputs.commitish }} permissions: contents: write @@ -41,7 +30,6 @@ jobs: uses: actions/checkout@v6 with: token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} - ref: ${{ inputs.ref || github.event.repository.default_branch }} - name: Set up Node uses: actions/setup-node@v6 @@ -104,20 +92,20 @@ jobs: uv run pnpm exec docusaurus docs:version "$MAJOR_MINOR_VERSION" uv run pnpm exec docusaurus api:version "$MAJOR_MINOR_VERSION" + - name: Stage versioned docs + id: stage + run: | + git pull --rebase --autostash + git add website/versioned_docs website/versioned_sidebars website/versions.json + if git diff --cached --quiet; then + echo "has-changes=false" >> "$GITHUB_OUTPUT" + else + echo "has-changes=true" >> "$GITHUB_OUTPUT" + fi + - name: Commit and push versioned docs - id: commit_versioned_docs - uses: EndBug/add-and-commit@v10 + if: steps.stage.outputs.has-changes == 'true' + uses: apify/workflows/commit@v0.44.0 with: - add: website/versioned_docs website/versioned_sidebars website/versions.json - message: "docs: Version docs for v${{ steps.snapshot.outputs.version }} [skip ci]" - default_author: github_actions - pull: '--rebase --autostash' - # `actions/checkout` detaches HEAD on SHA refs; EndBug needs a branch to push. - new_branch: ${{ github.event.repository.default_branch }} - - - name: Resolve output commitish - id: resolve_commitish - env: - COMMIT_SHA: ${{ steps.commit_versioned_docs.outputs.commit_long_sha }} - run: | - echo "commitish=${COMMIT_SHA:-$(git rev-parse HEAD)}" >> "$GITHUB_OUTPUT" + commit-message: "docs: Version docs for v${{ steps.snapshot.outputs.version }} [skip ci]" + github-token: ${{ secrets.APIFY_SERVICE_ACCOUNT_GITHUB_TOKEN }} diff --git a/.github/workflows/on_master.yaml b/.github/workflows/on_master.yaml index 11f133e1..e6ab480f 100644 --- a/.github/workflows/on_master.yaml +++ b/.github/workflows/on_master.yaml @@ -25,9 +25,6 @@ jobs: pages: write id-token: write uses: ./.github/workflows/manual_release_docs.yaml - with: - # Use the same ref as the one that triggered the workflow. - ref: ${{ github.ref }} secrets: inherit code_checks: