From 589161da83e7a7167ca4eb5d9ac8ba0f5c7cec86 Mon Sep 17 00:00:00 2001 From: Sander Blue Date: Wed, 28 Aug 2024 15:55:39 -0500 Subject: [PATCH] chore(automation): test attempt to pass new API endpoints to generate workflow --- .github/workflows/generate.yml | 87 ++++++++++++++++++---------- .github/workflows/graphql-schema.yml | 13 ++++- 2 files changed, 67 insertions(+), 33 deletions(-) diff --git a/.github/workflows/generate.yml b/.github/workflows/generate.yml index 3d095ac1d..de4c48cc0 100644 --- a/.github/workflows/generate.yml +++ b/.github/workflows/generate.yml @@ -1,47 +1,72 @@ name: Tutone Generate on: + push: + branches: + - 'feat/automated-codegen' workflow_dispatch: + inputs: + apiEndpoints: + required: true + type: string + description: 'The API endpoints for which to generate code' workflow_call: + inputs: + apiEndpoints: + required: true + type: string + description: 'The API endpoints for which to generate code' jobs: - createPullRequest: + generate: runs-on: ubuntu-latest steps: - - name: Install Go - uses: actions/setup-go@v5 + - name: Write temporary Tutone config file + uses: DamianReeves/write-file-action@master with: - go-version: 1.21.x + path: .tutone.yml + contents: | + ${{ inputs.apiEndpoints }} + write-mode: overwrite - - name: Add GOBIN to PATH - run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + - name: Check config file contents + run: cat .tutone.yml shell: bash - - name: Checkout code - uses: actions/checkout@v4 + # - name: Install Go + # uses: actions/setup-go@v5 + # with: + # go-version: 1.21.x - - name: Set up git user - run: | - git config --global user.name nr-developer-toolkit - git config --global user.email nr-developer-toolkit@users.noreply.github.com + # - name: Add GOBIN to PATH + # run: echo "$(go env GOPATH)/bin" >> $GITHUB_PATH + # shell: bash - - name: Install Tutone - run: go install github.com/newrelic/tutone/cmd/tutone@latest + # - name: Checkout code + # uses: actions/checkout@v4 - - name: Generate new code - run: make generate - env: - NEW_RELIC_API_KEY: ${{ secrets.NEW_RELIC_API_KEY }} + # - name: Set up git user + # run: | + # git config --global user.name nr-developer-toolkit + # git config --global user.email nr-developer-toolkit@users.noreply.github.com - - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 - with: - token: ${{ secrets.DEV_TOOLKIT_TOKEN }} - commit-message: 'chore(tutone): update generated code' - signoff: false - branch: feat/generated-code - title: 'feat(codegen): generate code based on latest API changes' - body: | - Update generated code using Tutone - labels: | - enhancement - draft: true + # - name: Install Tutone + # run: go install github.com/newrelic/tutone/cmd/tutone@latest + + # - name: Generate new code + # run: tutone generate + # env: + # NEW_RELIC_API_KEY: ${{ secrets.NEW_RELIC_API_KEY }} + + # - name: Create Pull Request + # uses: peter-evans/create-pull-request@v3 + # with: + # token: ${{ secrets.DEV_TOOLKIT_TOKEN }} + # commit-message: 'chore(tutone): update generated code' + # signoff: false + # branch: feat/generated-code + # title: 'feat(codegen): generate code based on latest API changes' + # body: | + # Update generated code using Tutone + # labels: | + # enhancement + # draft: true diff --git a/.github/workflows/graphql-schema.yml b/.github/workflows/graphql-schema.yml index 815c4e730..26592f15a 100644 --- a/.github/workflows/graphql-schema.yml +++ b/.github/workflows/graphql-schema.yml @@ -1,5 +1,8 @@ name: NerdGraph Schema Diff on: + push: + branches: + - 'feat/automated-codegen' workflow_dispatch: schedule: # Cron executes at 0800, 1200, 1600 UTC (8am, 12pm, 4pm) @@ -150,6 +153,12 @@ jobs: if-no-files-found: error overwrite: true - create-codegen-pr: - if: steps.schema-diff.outputs.hero_mention != '' + generate-code: + # if: steps.schema-diff.outputs.hero_mention != '' uses: newrelic/newrelic-client-go/.github/workflows/generate.yml@main + with: + apiEndpoints: '[autoflowsDeleteWorkflowDefinition, autoflowsStopWorkflowRun, autoflowsUpdateWorkflowDefinition]' + secrets: + NEW_RELIC_API_KEY: ${{ secrets.NEW_RELIC_API_KEY }} + DEV_TOOLKIT_TOKEN: ${{ secrets.DEV_TOOLKIT_TOKEN }} +