Skip to content

Create config_docs workflow #11

Create config_docs workflow

Create config_docs workflow #11

Workflow file for this run

name: Update Config Docs
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
create-config-docs-pr:
runs-on: ubuntu-22.04
permissions:
contents: write
pull-requests: write
steps:
- name: Install Ruby 3.2
uses: ruby/setup-ruby@7d546f4868fb108ed378764d873683f920672ae2 # tag v1.149.0
with:
ruby-version: 3.2
- name: Checkout code
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # tag v3.5.0
- run: bundle
- name: Generate config doc
run: bundle exec rake newrelic:config:docs[html]
- name: Create branch name
run: echo "branch_name=ruby-config-updates" >> $GITHUB_ENV
- name: Create branch
uses: dmnemec/copy_file_to_another_repo_action@c93037aa10fa8893de271f19978c980d0c1a9b37 # tag v1.1.1
env:
API_TOKEN_GITHUB: ${{ secrets.KAYLA_CONFIG_DOCS }}
with:
source_file: "ruby-agent-configuration.mdx"
destination_repo: 'kaylareopelle/docs-website'
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: ${{ env.branch_name }}
commit_message: 'chore(ruby agent): Update config docs'
- name: Create pull request
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/
HEAD: ${{ env.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]
runs-on: ubuntu-22.04
if: failure()
steps:
- name: Checkout agent repository
uses: actions/checkout@8f4b7f84864484a7bf31766abe9204da3cbe65b3 # tag v3.5.0
- name: Get branch name
run: echo "branch_name=ruby-config-updates" >> $GITHUB_ENV
- name: Checkout docs website repository
uses: actions/checkout@v3
with:
repository: kaylareopelle/docs-website
token: ${{ secrets.KAYLA_CONFIG_DOCS }}
- name: Build delete command
run: echo "delete_file=git push origin --delete ${{ env.branch_name }} --force" >> $GITHUB_ENV
- name: Delete branch
run: ${{ env.delete_file }}