Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Snorkell.ai]: Setting up Automated AI-Driven Documentation for GitHub! #1

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions .github/workflows/snorkell-auto-documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# This workflow will improvise current file with AI genereated documentation and Create new PR

name: Snorkell.ai - Revolutionizing Documentation on GitHub

on:
push:
branches: ["main"]
workflow_dispatch:

jobs:
Documentation:
runs-on: ubuntu-latest

steps:
- name: Extract branch name
shell: bash
run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV
- name: Extract PR title from commit message
shell: bash
run: |
COMMIT_MSG="${{ github.event.head_commit.message }}"
if [[ "$COMMIT_MSG" == "Merge pull request"* ]]; then
PR_TITLE=$(echo "$COMMIT_MSG" | awk -F "- " '{print $2}')
echo "PR_TITLE=$PR_TITLE" >> $GITHUB_ENV
fi
- name: Extract first line of commit message
shell: bash
run: |
FIRST_LINE=$(echo "${{ github.event.head_commit.message }}" | head -n 1)
echo "FIRST_LINE=${FIRST_LINE}" >> $GITHUB_ENV
- name: Run Script
shell: bash
run: |
echo "Commit Message: ${{ github.event.head_commit.message }}"
echo "Commit Message - First line: ${{ env.FIRST_LINE }}"
echo "PR Title: ${{ env.PR_TITLE }}"
echo "Repository: ${{ github.repository }}"
echo "Branch Name: ${{ env.BRANCH_NAME}}"
echo "Commit SHA: ${{ github.sha}}"
curl --max-time 600 -X POST -H 'api-key: ${{ secrets.SNORKELL_API_KEY }}' -H 'Content-Type: application/json' \
-d '{"installation_id": "${{ secrets.SNORKELL_CLIENT_ID }}", "full_repo_name": "${{ github.repository }}", "base_branch": "${{ env.BRANCH_NAME }}", "commit_sha": "${{ github.sha }}", "commit_message": "${{ env.FIRST_LINE }}"}' \
https://production-gateway.snorkell.ai/api/app/github/generate/documentation