Update Config Docs #55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Update Config Docs | |
| on: | |
| workflow_dispatch: | |
| env: | |
| BRANCH_NAME: ruby-config-updates | |
| DESTINATION_REPO: newrelic/docs-website | |
| jobs: | |
| regenerate_config_docs: | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| steps: | |
| - name: Install Ruby 3.4 | |
| uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # tag v1.267.0 | |
| with: | |
| ruby-version: 3.4 | |
| - name: Checkout code | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # tag v5.0.0 | |
| - run: bundle | |
| - name: Generate config doc | |
| run: bundle exec rake newrelic:config:docs[html] | |
| - name: Create branch | |
| uses: dmnemec/copy_file_to_another_repo_action@c93037aa10fa8893de271f19978c980d0c1a9b37 # tag v1.1.1 | |
| env: | |
| API_TOKEN_GITHUB: ${{ secrets.NEWRELIC_RUBY_AGENT_BOT_TOKEN }} | |
| with: | |
| source_file: "ruby-agent-configuration.mdx" | |
| destination_repo: ${{ env.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: ${{ env.BRANCH_NAME }} | |
| commit_message: 'chore(ruby agent): Update config docs' | |
| - name: Create PR | |
| run: gh pr create --base "develop" --repo "$REPO" --head "$HEAD" --title "$TITLE" --body "$BODY" | |
| env: | |
| GH_TOKEN: ${{ secrets.NEWRELIC_RUBY_AGENT_BOT_TOKEN }} | |
| REPO: "https://github.com/${{ env.DESTINATION_REPO }}" | |
| HEAD: "${{ env.BRANCH_NAME }}" | |
| TITLE: "Update Ruby configuration docs" | |
| 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: [regenerate_config_docs] | |
| runs-on: ubuntu-22.04 | |
| if: failure() | |
| steps: | |
| - name: Checkout agent repository | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # tag v5.0.0 | |
| - name: Checkout docs website repository | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # tag v5.0.0 | |
| with: | |
| token: ${{ secrets.NEWRELIC_RUBY_AGENT_BOT_TOKEN }} | |
| repository: ${{ env.DESTINATION_REPO }} | |
| - 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 }} |