Skip to content

Commit

Permalink
Step updates
Browse files Browse the repository at this point in the history
  • Loading branch information
kaylareopelle committed Jul 12, 2023
1 parent dd7af45 commit 6431863
Showing 1 changed file with 23 additions and 7 deletions.
30 changes: 23 additions & 7 deletions .github/workflows/config_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@ on:

env:
BRANCH_NAME: ruby-config-updates
DESTINATION_REPO: kaylareopelle/docs-website

jobs:
create-config-docs-pr:
regenerate_config_docs:
runs-on: ubuntu-22.04
permissions:
contents: write
Expand All @@ -36,33 +37,48 @@ jobs:
API_TOKEN_GITHUB: ${{ secrets.KAYLA_CONFIG_DOCS }}
with:
source_file: "ruby-agent-configuration.mdx"
destination_repo: 'kaylareopelle/docs-website'
destination_repo: $DESTINATION_REPO
destination_folder: 'src/content/docs/apm/agents/ruby-agent/configuration'
user_email: '${{ secrets.EMAIL }}'
user_name: 'newrelic-ruby-agent-bot'
destination_branch: 'develop'
destination_branch_create: $BRANCH_NAME
commit_message: 'chore(ruby agent): Update config docs'

check_diff_for_changes:
runs-on: ubuntu-22.04
needs: [regenerate_config_docs]
steps:
- name: Checkout code
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # tag v3.5.0
with:
repository: $DESTINATION_REPO
ref: $BRANCH_NAME
token: ${{ secrets.KAYLA_CONFIG_DOCS }}

- name: Check diff
run: |
git diff --quiet src/content/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration.mdx && exit 0
create_pull_request:
runs-on: ubuntu-22.04
needs: [create-config-docs-pr]
if: ${{ git diff --quiet src/content/docs/apm/agents/ruby-agent/configuration/ruby-agent-configuration.mdx && exit 0 }}
needs: [regenerate_config_docs, check_diff_for_changes]
if: success()
permissions:
pull-requests: write
steps:
- name: Create PR
run: gh pr create --base "develop" --repo "$REPO" --head "$HEAD" --title "$TITLE" --body "$BODY"
env:
GH_TOKEN: ${{ secrets.KAYLA_CONFIG_DOCS }}
REPO: https://github.com/kaylareopelle/docs-website/
REPO: 'https://github.com/${{ $DESTINATION_REPO }}'
HEAD: $BRANCH_NAME
TITLE: "Ruby configuration docs test"
BODY: "This is an automated PR generated by the Ruby agent CI. Please delete the branch on merge."

delete_branch_on_fail:
name: Delete branch on fail
needs: [create-config-docs-pr]
needs: [regenerate_config_docs]
runs-on: ubuntu-22.04
if: failure()
steps:
Expand All @@ -72,7 +88,7 @@ jobs:
- name: Checkout docs website repository
uses: actions/checkout@v3
with:
repository: kaylareopelle/docs-website
repository: $DESTINATION_REPO
token: ${{ secrets.KAYLA_CONFIG_DOCS }}

- name: Build delete command
Expand Down

0 comments on commit 6431863

Please sign in to comment.