Skip to content

Commit f3e89c1

Browse files
authored
Merge b8082f0 into 00e83a3
2 parents 00e83a3 + b8082f0 commit f3e89c1

File tree

2 files changed

+97
-0
lines changed

2 files changed

+97
-0
lines changed
+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Update API reports
2+
3+
on: pull_request
4+
5+
jobs:
6+
check_doc_changes:
7+
name: Check if docs are being changed
8+
runs-on: ubuntu-latest
9+
10+
steps:
11+
- name: Checkout Repo
12+
uses: actions/checkout@master
13+
with:
14+
# This makes Actions fetch all Git history so check_changeset script can diff properly.
15+
fetch-depth: 0
16+
- name: Set up Node (14)
17+
uses: actions/setup-node@v2
18+
with:
19+
node-version: 14.x
20+
- name: Yarn install
21+
run: yarn
22+
- name: Update API reports
23+
run: yarn ts-node-script scripts/exp/update-api-reports.ts
24+
id: update-api-reports
25+
- name: Push changes
26+
uses: ad-m/[email protected]
27+
with:
28+
github_token: ${{ secrets.GITHUB_TOKEN }}
29+
branch: ${{ github.head_ref }}

scripts/exp/update-api-reports.ts

+68
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/**
2+
* @license
3+
* Copyright 2021 Google LLC
4+
*
5+
* Licensed under the Apache License, Version 2.0 (the "License");
6+
* you may not use this file except in compliance with the License.
7+
* You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
import { spawn } from 'child-process-promise';
18+
import simpleGit from 'simple-git/promise';
19+
import { projectRoot } from '../utils';
20+
21+
const git = simpleGit(projectRoot);
22+
23+
async function updateApiReports() {
24+
/** API reports are generated as part of the builds */
25+
// TODO: change yarn command once exp packages become official
26+
await spawn('yarn', ['lerna', 'run', '--scope', '@firebase/*-exp', 'build'], {
27+
stdio: 'inherit'
28+
});
29+
30+
// build storage-exp
31+
await spawn(
32+
'yarn',
33+
['lerna', 'run', '--scope', '@firebase/storage', 'build:exp'],
34+
{
35+
stdio: 'inherit'
36+
}
37+
);
38+
39+
// build database-exp
40+
await spawn(
41+
'yarn',
42+
['lerna', 'run', '--scope', '@firebase/database', 'build:exp'],
43+
{
44+
stdio: 'inherit'
45+
}
46+
);
47+
48+
// generate public typings for firestore
49+
await spawn(
50+
'yarn',
51+
['lerna', 'run', '--scope', '@firebase/firestore', 'prebuild'],
52+
{
53+
stdio: 'inherit'
54+
}
55+
);
56+
57+
// stage api reviews
58+
await git.add('common/api-review/*');
59+
60+
// reset unrelated changes
61+
await git.checkout('.');
62+
63+
await git.commit('Update API reports');
64+
65+
// Pushing to the remote branch is done in the GHA workflow, see .github/workflows/update-api-reports.yml
66+
}
67+
68+
updateApiReports();

0 commit comments

Comments
 (0)