Skip to content

Commit

Permalink
chore(automation): attempt to create the first automated PR for codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
sanderblue committed Sep 25, 2024
1 parent 7fd672d commit ed3d890
Showing 1 changed file with 20 additions and 12 deletions.
32 changes: 20 additions & 12 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ jobs:

- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.RELEASE_TOKEN }}

- name: Set up git user
run: |
Expand All @@ -48,9 +51,9 @@ jobs:
- name: Install Tutone
run: go install github.com/newrelic/tutone/cmd/tutone@latest

- name: Echo stuff for a testing purposes
run: echo "${{ inputs.packages }}"
shell: bash
# - name: Echo stuff for a testing purposes
# run: echo "${{ inputs.packages }}" && echo "Branch Name - ${{ github.ref_name }}"
# shell: bash

# TODO: Append configuration to the config file OR write temporary Tutone config file?
- name: Write config file
Expand All @@ -68,23 +71,28 @@ jobs:
env:
NEW_RELIC_API_KEY: ${{ secrets.NEW_RELIC_API_KEY }}

- name: Commit and push changes
- 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 add pkg
git commit --no-verify -m 'feat(codegen): generate code based on latest API changes'
git push origin HEAD:${{ github.ref_name }}
# git commit --no-verify -m "chore(release): release v${VER_NEXT}"
# git push --no-verify origin HEAD:${DEFAULT_BRANCH}
git push origin $branch_name
- name: Create Pull Request
- name: Create pull request
uses: peter-evans/create-pull-request@v3
with:
token: ${{ secrets.DEV_TOOLKIT_TOKEN }}
commit-message: 'chore(tutone): update generated code'
commit-message: 'feat(automation): update generated code'
signoff: false
branch: feat/generated-code
title: 'feat(codegen): generate code based on latest API changes'
branch: automation/generated-code
title: 'feat(automation): generate code based on latest API changes'
body: |
Update generated code using Tutone
labels: |
Expand Down

0 comments on commit ed3d890

Please sign in to comment.