Skip to content

Commit

Permalink
feat: add codegen to pr (#725)
Browse files Browse the repository at this point in the history
Signed-off-by: hxtree <[email protected]>
  • Loading branch information
hxtree authored Nov 27, 2023
1 parent b931261 commit cdb31dd
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/call-codegen.yml
Original file line number Diff line number Diff line change
@@ -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/[email protected]
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 "[email protected]"
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 }}

8 changes: 8 additions & 0 deletions .github/workflows/on-pull-request-opened.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions services/player-achievements/src/models/trophy.schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,27 +11,31 @@ export class Trophy {

@IsUuidV4()
@Prop({
required: true,
type: String,
default: () => v4(),
})
public _id!: string;

@IsUuidV4()
@Prop({
required: true,
type: String,
default: () => v4(),
})
public title: string;

@IsUuidV4()
@Prop({
required: true,
type: String,
default: () => v4(),
})
public description: string;

@IsDateString()
@Prop({
required: true,
type: String,
default: () => new Date().toISOString(),
})
Expand Down

0 comments on commit cdb31dd

Please sign in to comment.