deploy-cloud-functions
deploy-cloud-functions copied to clipboard
feat: Adding Utils Directory and new workflow file for Self-Updating Readme
This PR is meant to automate self updating the deploy-cloud-function readme to include up to date event trigger types from gcloud. Example output below:
This PR specifically adds:
-
Utilsdirectory for self-updating readme files, which include (main.moustache: readme template file with variables returned from gcloud command.updateReadme.ts: contains script to grab updated event trigger types from gcloud command, then writes new readme file.tsconfig.json: self-contained to utils directory, used to build update readme script) -
updateReadme.ymlcontains the workflow file that uses our auth action, builds and runs update readme script, and uses peter evans' create pull request action of a specific version -peter-evans/create-pull-request@dcd5fd746d53dd8de555c0f10bca6c35628be47ato commit Readme from machine user fork. -
build-readmenew script in package.json that buildsupdateReadme.tsand outputs to a tmp folder
Other notes:
- Due to self contained tsconfig.json in the utils folder, excluding
updateReadme.tsfrom tsconfig.json in parent directory - Additional Dependencies needed for this script were all added as devDependencies in
package.json. Question: Would it be better to just separate these entirely so the dependencies for this script are in a separate package.json (specific to the utils)? - Related Issues (https://github.com/google-github-actions/deploy-cloud-functions/issues/58, https://github.com/google-github-actions/deploy-cloud-functions/issues/307)
TODO's:
- update workflow file bot user as committer, token for bot user as well as path to bot user fork
- update workflow file with appropriate WIF provider and SA email account
Implemented a similar approach to what y'all had recommended:
-
docsfile with event table markdown that script writes to (uses html comments to identify substring to be replaced in markdown file) -
gcloudcommand as step in workflow outputting results to anevents.jsonfile - simplified the
updateReadme.tsto account for this and removed all previously added dependencies