Skip to content

Commit

Permalink
chore(automation): attempt 2 to create the first automated PR for cod…
Browse files Browse the repository at this point in the history
…egen
  • Loading branch information
sanderblue committed Sep 27, 2024
1 parent 04d8ac9 commit 42b43c5
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 61 deletions.
54 changes: 35 additions & 19 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ on:
description: 'The API endpoints for which to generate code'
workflow_call:
inputs:
packages:
required: true
type: string
description: 'A comma-separated list of packages to generate for which to generate code'
apiEndpoints:
required: true
type: string
Expand Down Expand Up @@ -71,37 +75,49 @@ jobs:
env:
NEW_RELIC_API_KEY: ${{ secrets.NEW_RELIC_API_KEY }}

# - name: Create new branch, commit, and push changes
# shell: bash
# run: |
# branch_name="tmp/generated-code"

# if git ls-remote --exit-code --heads origin $branch_name > /dev/null; then
# git push origin --delete $branch_name
# fi

# git checkout -b $branch_name

# git status
# git add pkg .tutone.tmp.yml
# git status

# git commit --no-verify -m 'feat(codegen): generate code based on latest API changes'
# git push origin $branch_name
- name: Remove old automation branch if present
shell: bash
run: |
branch_name="automation/generated-code"
if git ls-remote --exit-code --heads origin $branch_name > /dev/null; then
git push origin --delete $branch_name
fi
- name: Create pull request
id: create-pull-request
uses: peter-evans/create-pull-request@v3
with:
base: main
add-paths: 'pkg'
add-paths: |
pkg
.tutone.tmp.yml
types.go
author: 'nr-developer-toolkit <[email protected]>'
token: ${{ secrets.DEV_TOOLKIT_TOKEN }}
commit-message: 'feat(automation): update generated code'
signoff: false
branch: automation/generated-code
title: 'feat(automation): generate code based on latest API changes'
body: |
Update generated code using Tutone
### Automated Pull Request
The following packages have been added or updated: `${{ inputs.packages }}`.
The following new mutations will be added to the codebase:
`${{ inputs.apiEndpoints }}`
Please perform the following actions before merging:
- [ ] Review the changes to the generated code
- [ ] Add new integration tests as necessary
- [ ] Update applicable tests as necessary
- [ ] Double check the .tutone.yml config file for accuracy
**Note:** If something looks off or you have questions, please reach out to an Observability as Code team member for assistance.
labels: |
enhancement
automated pr
draft: true

- name: Pull request URL
run: |
echo "Pull Request: ${{ steps.create-pull-request.outputs.pull-request-url }}"
5 changes: 2 additions & 3 deletions .github/workflows/graphql-schema.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
runs-on: ubuntu-latest
outputs:
apiEndpoints: ${{ steps.schema-diff.outputs.tutone_config }}
packages: ${{ steps.schema-diff.outputs.packages }}
steps:
- name: Install Node
uses: actions/setup-node@v4
Expand Down Expand Up @@ -161,8 +162,6 @@ jobs:
uses: newrelic/newrelic-client-go/.github/workflows/generate.yml@feat/automated-codegen
with:
apiEndpoints: ${{ needs.checkForApiUpdates.outputs.apiEndpoints }}
packages: ${{ needs.checkForApiUpdates.outputs.packages }}
secrets: inherit
# secrets:
# NEW_RELIC_API_KEY: ${{ secrets.NEW_RELIC_API_KEY }}
# DEV_TOOLKIT_TOKEN: ${{ secrets.DEV_TOOLKIT_TOKEN }}

39 changes: 0 additions & 39 deletions schema-test-new.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,45 +24,6 @@
}
}
]
},
{
"name": "userManagementCreateGroup",
"description": "A mutation for creating a group in an authentication domain.",
"type": {
"name": "UserManagementCreateGroupPayload",
"kind": "OBJECT"
},
"args": [
{
"name": "createGroupOptions",
"description": "The input object representing the group to create",
"type": {
"name": "UserManagementCreateGroup",
"kind": "INPUT_OBJECT"
}
}
]
},
{
"name": "userManagementCreateUser",
"description": "A mutation for creating a user in an authentication domain.",
"type": {
"name": "UserManagementCreateUserPayload",
"kind": "OBJECT"
},
"args": [
{
"name": "createUserOptions",
"description": "The input object representing the user to be created.",
"type": {
"kind": "NON_NULL",
"ofType": {
"name": "UserManagementCreateUser",
"kind": "INPUT_OBJECT"
}
}
}
]
}
]
},
Expand Down

0 comments on commit 42b43c5

Please sign in to comment.