From cdb31dd90849cdea277b310b8085a5e860d841b8 Mon Sep 17 00:00:00 2001 From: Matthew Heroux Date: Sun, 26 Nov 2023 18:03:15 -0600 Subject: [PATCH] feat: add codegen to pr (#725) Signed-off-by: hxtree --- .github/workflows/call-codegen.yml | 62 +++++++++++++++++++ .github/workflows/on-pull-request-opened.yml | 8 +++ .../src/models/trophy.schema.ts | 4 ++ 3 files changed, 74 insertions(+) create mode 100644 .github/workflows/call-codegen.yml diff --git a/.github/workflows/call-codegen.yml b/.github/workflows/call-codegen.yml new file mode 100644 index 00000000..f1579e62 --- /dev/null +++ b/.github/workflows/call-codegen.yml @@ -0,0 +1,62 @@ +name: Codegen + +on: + workflow_call: + inputs: + PR_NUMBER: + required: true + type: number + secrets: + USER_GITHUB_TOKEN: + required: true +jobs: + rush-update: + name: rush update + timeout-minutes: 15 + runs-on: ubuntu-latest + steps: + - name: setup Node + uses: actions/setup-node@v3 + with: + node-version: '18.12.0' + + - name: Check out code base + uses: actions/checkout@v3 + + - name: checkout code base + run: gh pr checkout ${{ inputs.PR_NUMBER }} + env: + GH_TOKEN: ${{ secrets.USER_GITHUB_TOKEN }} + + - name: cache rush + id: cache + uses: actions/cache@v3.2.2 + with: + path: common/temp + key: ${{ runner.os }}-build-branch-${{ hashFiles('common/config/rush/repo-state.json') }} + restore-keys: | + ${{ runner.os }}-build-pr- + ${{ runner.os }}-build- + ${{ runner.os }}- + + - name: rush install + run: node common/scripts/install-run-rush.js install + + - name: rush build + run: node common/scripts/install-run-rush.js build + + - name: rush update + run: node common/scripts/install-run-rush.js update + + - name: push changes + run: | + npm install --global lint-staged + npm install --global prettier + git config --global user.email "support@github.com" + git config --global user.name "dependabot[bot]" + git add . + git commit -m 'chore(deps): update shrinkwrap' + git push + env: + GH_TOKEN: ${{ secrets.USER_GITHUB_TOKEN }} + diff --git a/.github/workflows/on-pull-request-opened.yml b/.github/workflows/on-pull-request-opened.yml index 86d26adb..a6d2ed1f 100644 --- a/.github/workflows/on-pull-request-opened.yml +++ b/.github/workflows/on-pull-request-opened.yml @@ -3,8 +3,16 @@ name: 'PR / Opened' on: pull_request: types: [opened] + workflow_dispatch: jobs: + Codegen: + uses: ./.github/workflows/call-codegen.yml + with: + PR_NUMBER: ${{ github.event.pull_request.number }} + secrets: + USER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + detect-branch: name: 'detect ticket' timeout-minutes: 5 diff --git a/services/player-achievements/src/models/trophy.schema.ts b/services/player-achievements/src/models/trophy.schema.ts index dab1b6dc..9a3d31ce 100644 --- a/services/player-achievements/src/models/trophy.schema.ts +++ b/services/player-achievements/src/models/trophy.schema.ts @@ -11,6 +11,7 @@ export class Trophy { @IsUuidV4() @Prop({ + required: true, type: String, default: () => v4(), }) @@ -18,6 +19,7 @@ export class Trophy { @IsUuidV4() @Prop({ + required: true, type: String, default: () => v4(), }) @@ -25,6 +27,7 @@ export class Trophy { @IsUuidV4() @Prop({ + required: true, type: String, default: () => v4(), }) @@ -32,6 +35,7 @@ export class Trophy { @IsDateString() @Prop({ + required: true, type: String, default: () => new Date().toISOString(), })