Skip to content

Commit aaee23e

Browse files
committed
docs(docs-infra): add documentation on debugging the events generation process
1 parent 5039275 commit aaee23e

File tree

2 files changed

+49
-3
lines changed

2 files changed

+49
-3
lines changed

.github/workflows/update-events.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
# Update the `events.json` file that powers the [AIO events page](https://angular.io/events) (if
2+
# necessary) and create a pull request.
3+
#
4+
# For more details on the overall process, see
5+
# [aio/scripts/generate-events/README.md](../../aio/scripts/generate-events/README.md).
6+
17
name: Update AIO events
28

39
on:

aio/scripts/generate-events/README.md

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,8 @@ In a nutshell, the setup can be summarized as follows:
4343

4444
1. The DevRel team keeps information about events in a Google Sheets spreadsheet (in the appropriate format).
4545
2. An Apps Script extension on the spreadsheet periodically saves the relevant information (such as event names and dates) in a Firebase Realtime Database.
46-
3. There is a script (that can be run periodically) which can query the database and generate `events.json` based on the latest data.
46+
3. There is a script which can query the database and generate `events.json` based on the latest data.
47+
4. A GitHub Actions periodically runs the script and creates a pull request if there are updates.
4748

4849

4950
#### Apps Script extension overview
@@ -68,6 +69,8 @@ Useful resource: https://stackoverflow.com/questions/53207906/how-to-integrate-f
6869
- Each team allocation sheet should have the event names on the second row (each under the corresponding date cell).
6970
Event names can optionally be links pointing to the event's web page.
7071

72+
_**NOTE:** For this project, we use our [Angular Conferences Speaker Tracker](https://docs.google.com/spreadsheets/d/1B_2VUYMmaNhjCTIFKYluI7BwOYj1rEcRJX1ttniqteQ) spreadsheet._
73+
7174
2. Create an [Apps Script extension](https://developers.google.com/apps-script/guides/sheets) for the aforementioned spreadsheet with the source code from the [apps-script-extension/](./apps-script-extension/) directory.
7275
To do this, open the spreadsheet, click on `Extensions > Apps Script`, create the necessary files as seen in the source code (with the difference that the `.js` extension must be replaced with `.gs`) and copy the source code.
7376
For `appsscript.json`, follow the instructions [here](https://developers.google.com/apps-script/concepts/manifests#editing_a_manifest) to make it appear in the in-browser editor.
@@ -80,12 +83,14 @@ Useful resource: https://stackoverflow.com/questions/53207906/how-to-integrate-f
8083
5. Follow the instructions [here](https://firebase.google.com/docs/rules/manage-deploy#generate_a_configuration_file) to set up [security rules](https://firebase.google.com/docs/rules) and make sure they are deployed to the Firebase project as needed.
8184
You can see the database security rules used for this project in [database.rules.json](../../database.rules.json).
8285
These rules will allow anyone to read the events from the database, but only someone with access to the Firebase project will be able to update the events in the database.
83-
NOTE: For this project, the rules are deployed as part of the `deploy_aio` CI job.
86+
87+
_**NOTE:** For this project, the rules are deployed as part of the `deploy_aio` CI job._
8488

8589
6. Ensure that the account that was used to create the Google Sheets trigger on step 3 also has access to the Firebase project (otherwise, the trigger will fail to update the database when events change in the spreadsheet).
8690

8791
7. Wire the [index.mjs](./index.mjs) script to run when necessary to generate an updated `events.json` file.
88-
NOTE: For this project, there is a [GitHub Action](https://github.com/angular/angular/blob/main/.github/workflows/update-events.yml) that periodically runs the script and creates a pull request (if necessary).
92+
93+
_**NOTE:** For this project, there is a [GitHub Action](../../../.github/workflows/update-events.yml) that periodically runs the script and creates a pull request (if necessary)._
8994

9095
8. Ensure that both [constants.gs](./apps-script-extension/constants.js) and [index.mjs](./index.mjs) point to the correct database URL.
9196

@@ -96,6 +101,41 @@ Although the source code in [apps-script-extension/](./apps-script-extension/) a
96101
Whenever a change is needed to be made to the Apps Script extension, the change should be applied in both places.
97102

98103

104+
### How to debug
105+
106+
If the process does not work as expected, i.e. changes are made to the spreadsheet but no pull request is created to update `event.json`, there are three places where one can look to find out at which point the process breaks:
107+
108+
1. Ensure that the Apps Script extension runs successfully:
109+
110+
- You can check the previous executions of the `updateEventsOnFirebase()` function by opening the spreadsheet and clicking on `Extensions > Apps Script > Executions`.
111+
There, you can see when the extension ran and also click on an execution to see the output log.
112+
113+
_**NOTE:** For this project, executions can be found [here](https://script.google.com/home/projects/1X4IxdwG3WBE-jGK_3PZi5Ud1y-A3V2x_ZbKd0dHZGudRJgL_ssLVS9y2/executions)._
114+
115+
- You can also manually run the `updateEventsOnFirebase()` function by opening the spreadsheet and clicking on `Extensions > Apps Script > Editor > persister.gs`.
116+
From there, choose the function in the dropdown at the top of the editor and click the `Run` button.
117+
118+
_**NOTE:** For this project, the editor can be found [here](https://script.google.com/home/projects/1X4IxdwG3WBE-jGK_3PZi5Ud1y-A3V2x_ZbKd0dHZGudRJgL_ssLVS9y2/edit)._
119+
120+
2. Ensure that the database contains the correct data:
121+
122+
- Visit the [Firebase console](https://console.firebase.google.com/), open the targeted project and click on `Realtime Database`.
123+
124+
- From there, you can explore the data and ensure that the `events` node contains the expected data.
125+
126+
_**NOTE:** For this project, the database can be found [here](https://console.firebase.google.com/project/angular-io/database/angular-io/data)._
127+
128+
3. If you have set up a GitHub Action, ensure that it runs successfully:
129+
130+
- You can check the previous runs of the GitHub action by visiting the repository page on GitHub, clicking the `Actions` tab and then choosing the correct workflow from the list on the left.
131+
132+
- From there, you can see when the action was run and also click on a run to see the completion status of each job and the output log.
133+
134+
- You can also manually run the action, by clicking the `Run workflow` button.
135+
136+
_**NOTE:** For this project, you can see runs of the `Update AIO events` GitHub Action [here](https://github.com/angular/angular/actions/workflows/update-events.yml)._
137+
138+
99139
### Trade-offs/Alternatives considered
100140

101141
This section describes trade-offs made and alternative implementations/variations that were considered.

0 commit comments

Comments
 (0)