From b0ad3c538032367f1d94987a976b97301817f8c5 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Mon, 24 Feb 2025 11:24:00 -0800 Subject: [PATCH 1/6] Remove auto-commit API report workflow --- .github/workflows/check-docs.yml | 15 +++++++- .github/workflows/update-api-reports.yml | 48 ------------------------ 2 files changed, 13 insertions(+), 50 deletions(-) delete mode 100644 .github/workflows/update-api-reports.yml diff --git a/.github/workflows/check-docs.yml b/.github/workflows/check-docs.yml index de182b3eeb0..a3218c68f54 100644 --- a/.github/workflows/check-docs.yml +++ b/.github/workflows/check-docs.yml @@ -35,13 +35,24 @@ jobs: run: yarn - name: Run doc generation run: yarn docgen:all + - name: Check for changes in common/api-review dir (fail if so) + run: | + if [[ -n "$(git status common/api-review --porcelain)" ]]; then + echo "Unstaged changes detected in api-report(s):" + git status -s + echo "COMMAND_TO_RUN='yarn build'" >> $GITHUB_OUTPUT + exit 1 + fi + # Overwrite the command if there are also docs-devsite changes since + # running yarn docgen:all will also run yarn build first. - name: Check for changes in docs-devsite dir (fail if so) run: | if [[ -n "$(git status docs-devsite --porcelain)" ]]; then - echo "Unstaged changes detected:" + echo "Unstaged changes detected in docs-devsite/:" git status -s + echo "COMMAND_TO_RUN='yarn docgen:all'" >> $GITHUB_OUTPUT exit 1 fi - name: Reference documentation needs to be updated. See message below. if: ${{ failure() }} - run: echo "Changes in this PR affect the reference docs. Run \`yarn docgen:all\` locally to regenerate docs and add them to this PR." \ No newline at end of file + run: echo "Changes in this PR affect the reference docs or API reports. Run \`$COMMAND_TO_RUN\` locally to regenerate the changed files and add them to this PR." \ No newline at end of file diff --git a/.github/workflows/update-api-reports.yml b/.github/workflows/update-api-reports.yml deleted file mode 100644 index c961889de98..00000000000 --- a/.github/workflows/update-api-reports.yml +++ /dev/null @@ -1,48 +0,0 @@ -# Copyright 2023 Google LLC -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name: Update API reports - -on: pull_request - -jobs: - update_api_reports: - name: Update API reports - runs-on: ubuntu-latest - - permissions: - contents: write - steps: - - name: Checkout Repo - uses: actions/checkout@v4 - with: - # checkout HEAD commit instead of merge commit - ref: ${{ github.event.pull_request.head.ref }} - token: ${{ github.token }} - - name: Set up node (20) - uses: actions/setup-node@v4 - with: - node-version: 22.10.0 - - name: Yarn install - run: yarn - - name: Update API reports - # API reports are generated as part of the build - run: yarn build - id: update-api-reports - - name: Commit & Push changes - uses: EndBug/add-and-commit@v9 - with: - add: 'common/api-review/*' - message: 'Update API reports' - default_author: github_actor \ No newline at end of file From 88377ae32d4d9519e581c1c0813b788a7c4d11c6 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Mon, 24 Feb 2025 11:35:56 -0800 Subject: [PATCH 2/6] fix command --- .github/workflows/check-docs.yml | 72 +++++++++++++++++--------------- 1 file changed, 38 insertions(+), 34 deletions(-) diff --git a/.github/workflows/check-docs.yml b/.github/workflows/check-docs.yml index a3218c68f54..ab7873d8008 100644 --- a/.github/workflows/check-docs.yml +++ b/.github/workflows/check-docs.yml @@ -22,37 +22,41 @@ jobs: runs-on: ubuntu-latest steps: - - name: Checkout Repo - uses: actions/checkout@v4 - with: - # get all history for the diff - fetch-depth: 0 - - name: Set up Node (20) - uses: actions/setup-node@v4 - with: - node-version: 22.10.0 - - name: Yarn install - run: yarn - - name: Run doc generation - run: yarn docgen:all - - name: Check for changes in common/api-review dir (fail if so) - run: | - if [[ -n "$(git status common/api-review --porcelain)" ]]; then - echo "Unstaged changes detected in api-report(s):" - git status -s - echo "COMMAND_TO_RUN='yarn build'" >> $GITHUB_OUTPUT - exit 1 - fi - # Overwrite the command if there are also docs-devsite changes since - # running yarn docgen:all will also run yarn build first. - - name: Check for changes in docs-devsite dir (fail if so) - run: | - if [[ -n "$(git status docs-devsite --porcelain)" ]]; then - echo "Unstaged changes detected in docs-devsite/:" - git status -s - echo "COMMAND_TO_RUN='yarn docgen:all'" >> $GITHUB_OUTPUT - exit 1 - fi - - name: Reference documentation needs to be updated. See message below. - if: ${{ failure() }} - run: echo "Changes in this PR affect the reference docs or API reports. Run \`$COMMAND_TO_RUN\` locally to regenerate the changed files and add them to this PR." \ No newline at end of file + - name: Checkout Repo + uses: actions/checkout@v4 + with: + # get all history for the diff + fetch-depth: 0 + - name: Set up Node (20) + uses: actions/setup-node@v4 + with: + node-version: 22.10.0 + - name: Yarn install + run: yarn + - name: Run doc generation + run: yarn docgen:all + - name: Check for changes in common/api-review dir (fail if so) + id: api-report-check + run: | + if [[ -n "$(git status common/api-review --porcelain)" ]]; then + echo "Unstaged changes detected in api-report(s):" + git status -s + echo "command-to-run='yarn build'" >> $GITHUB_OUTPUT + exit 1 + fi + # Overwrite the command if there are also docs-devsite changes since + # running yarn docgen:all will also run yarn build first. + - name: Check for changes in docs-devsite dir (fail if so) + id: docs-check + run: | + if [[ -n "$(git status docs-devsite --porcelain)" ]]; then + echo "Unstaged changes detected in docs-devsite/:" + git status -s + echo "command-to-run='yarn docgen:all'" >> $GITHUB_OUTPUT + exit 1 + fi + - name: Reference documentation needs to be updated. See message below. + if: ${{ failure() }} + run: echo "Changes in this PR affect the reference docs or API reports. Run \`$COMMAND_TO_RUN\` locally to regenerate the changed files and add them to this PR." + env: + COMMAND_TO_RUN: ${{ steps.docs-check.outputs.command-to-run || steps.api-report-check.outputs.command-to-run }} From ff65f31816109b04dc8b02fc86190a442d7ff909 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Mon, 24 Feb 2025 11:36:42 -0800 Subject: [PATCH 3/6] add test diff --- common/api-review/analytics.api.md | 1 + 1 file changed, 1 insertion(+) diff --git a/common/api-review/analytics.api.md b/common/api-review/analytics.api.md index 58cb8d4a0ce..74a24752931 100644 --- a/common/api-review/analytics.api.md +++ b/common/api-review/analytics.api.md @@ -6,6 +6,7 @@ import { FirebaseApp } from '@firebase/app'; +// test // @public export interface Analytics { app: FirebaseApp; From 369441af0986f15809bd79ae0450d6546119c036 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Mon, 24 Feb 2025 11:51:12 -0800 Subject: [PATCH 4/6] get rid of final message step --- .github/workflows/check-docs.yml | 27 ++++++++++----------------- 1 file changed, 10 insertions(+), 17 deletions(-) diff --git a/.github/workflows/check-docs.yml b/.github/workflows/check-docs.yml index ab7873d8008..4afd97a131f 100644 --- a/.github/workflows/check-docs.yml +++ b/.github/workflows/check-docs.yml @@ -35,28 +35,21 @@ jobs: run: yarn - name: Run doc generation run: yarn docgen:all - - name: Check for changes in common/api-review dir (fail if so) - id: api-report-check + # Fail first if there are docs-devsite changes since running yarn docgen:all + # will also regenerate any API report changes. + - name: Check for changes in docs-devsite dir (fail if so) run: | - if [[ -n "$(git status common/api-review --porcelain)" ]]; then - echo "Unstaged changes detected in api-report(s):" + if [[ -n "$(git status docs-devsite --porcelain)" ]]; then + echo "Unstaged changes detected in docs-devsite/:" git status -s - echo "command-to-run='yarn build'" >> $GITHUB_OUTPUT + echo "Changes in this PR affect the reference docs or API reports. Run \`yarn docgen:all\` locally to regenerate the changed files and add them to this PR." exit 1 fi - # Overwrite the command if there are also docs-devsite changes since - # running yarn docgen:all will also run yarn build first. - - name: Check for changes in docs-devsite dir (fail if so) - id: docs-check + - name: Check for changes in common/api-review dir (fail if so) run: | - if [[ -n "$(git status docs-devsite --porcelain)" ]]; then - echo "Unstaged changes detected in docs-devsite/:" + if [[ -n "$(git status common/api-review --porcelain)" ]]; then + echo "Unstaged changes detected in api-report(s):" git status -s - echo "command-to-run='yarn docgen:all'" >> $GITHUB_OUTPUT + echo "Changes in this PR affect the API reports. Run \`yarn build\` locally to regenerate the API reports and add them to this PR." exit 1 fi - - name: Reference documentation needs to be updated. See message below. - if: ${{ failure() }} - run: echo "Changes in this PR affect the reference docs or API reports. Run \`$COMMAND_TO_RUN\` locally to regenerate the changed files and add them to this PR." - env: - COMMAND_TO_RUN: ${{ steps.docs-check.outputs.command-to-run || steps.api-report-check.outputs.command-to-run }} From b675251fdc84c635d3ad779d8eacace1f32bc036 Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Mon, 24 Feb 2025 13:44:36 -0800 Subject: [PATCH 5/6] add a test line to docs-devsite --- docs-devsite/analytics.analytics.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs-devsite/analytics.analytics.md b/docs-devsite/analytics.analytics.md index dcf0038f2d9..f69e05681d1 100644 --- a/docs-devsite/analytics.analytics.md +++ b/docs-devsite/analytics.analytics.md @@ -10,7 +10,7 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # Analytics interface -An instance of Firebase Analytics. +An instance of Firebase Analytics. test Signature: From 3c1340181c2edaabdf0da0043dfadd7d486b69fb Mon Sep 17 00:00:00 2001 From: Christina Holland Date: Mon, 24 Feb 2025 15:30:03 -0800 Subject: [PATCH 6/6] revert test files --- common/api-review/analytics.api.md | 1 - docs-devsite/analytics.analytics.md | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/common/api-review/analytics.api.md b/common/api-review/analytics.api.md index 74a24752931..58cb8d4a0ce 100644 --- a/common/api-review/analytics.api.md +++ b/common/api-review/analytics.api.md @@ -6,7 +6,6 @@ import { FirebaseApp } from '@firebase/app'; -// test // @public export interface Analytics { app: FirebaseApp; diff --git a/docs-devsite/analytics.analytics.md b/docs-devsite/analytics.analytics.md index f69e05681d1..dcf0038f2d9 100644 --- a/docs-devsite/analytics.analytics.md +++ b/docs-devsite/analytics.analytics.md @@ -10,7 +10,7 @@ https://github.com/firebase/firebase-js-sdk {% endcomment %} # Analytics interface -An instance of Firebase Analytics. test +An instance of Firebase Analytics. Signature: