deploy-cloud-functions icon indicating copy to clipboard operation
deploy-cloud-functions copied to clipboard

feat: Adding Utils Directory and new workflow file for Self-Updating Readme

Open LukaFontanilla opened this issue 2 years ago • 1 comments

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:

Screen Shot 2022-03-22 at 3 15 16 PM

This PR specifically adds:

  • Utils directory 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.yml contains 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@dcd5fd746d53dd8de555c0f10bca6c35628be47a to commit Readme from machine user fork.
  • build-readme new script in package.json that builds updateReadme.ts and outputs to a tmp folder

Other notes:

  • Due to self contained tsconfig.json in the utils folder, excluding updateReadme.ts from 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

LukaFontanilla avatar Mar 22 '22 22:03 LukaFontanilla

Implemented a similar approach to what y'all had recommended:

  • docs file with event table markdown that script writes to (uses html comments to identify substring to be replaced in markdown file)
  • gcloud command as step in workflow outputting results to an events.json file
  • simplified the updateReadme.ts to account for this and removed all previously added dependencies

LukaFontanilla avatar Mar 24 '22 21:03 LukaFontanilla