This repository is dedicated to hosting reusable GitHub Actions YAML files that can be shared across different repositories. Centralizing common actions, to promote consistency and efficiency in workflows.
DocSync AI automatically keeps your documentation in sync with your code changes using Claude AI.
When a PR is merged, DocSync AI:
- Analyzes the code changes
- Determines if documentation needs updates
- Automatically updates README.md or CLAUDE.md
- Creates a new PR with the documentation changes
On any DocSync-generated PR, team members can request specific changes using the @docbot command interface:
@docbot update readme
@docbot clarify auth section
@docbot add example for API authentication
@docbot expand installation steps
@docbot fix typo in configuration section
@docbot revert last change
The AI will:
- Review the command with full context
- Make the final decision on what changes to apply
- Commit updates directly to the DocSync PR
- Provide quality control and sanitization
- Support revert capability for easy rollback
In your repository (Settings > Secrets and variables > Actions), add:
| Secret Name | Description | How to Get |
|---|---|---|
DOCSYNC_GITHUB_TOKEN |
Personal Access Token with repo and workflow scopes |
Create token |
DOCSYNC_ANTHROPIC_API_KEY |
Anthropic API key for Claude AI | Get API key |
Optional: Slack Notifications
DocSync AI supports two methods for Slack notifications:
Method 1: OAuth Token (Recommended)
- Stores OAuth token in shared-actions repo (more secure, centralized)
- Each consuming repo provides channel ID and user ID
- Better control and user mentions
Method 2: Webhook (Legacy)
- Each repo stores its own webhook URL
- Simpler setup but less flexible
Setup for OAuth Method:
-
In shared-actions repo (this repo), add secret:
SLACK_OAUTH_TOKEN- Slack Bot OAuth token withchat:writescope (Create Slack App)
-
In your consuming repo, get Slack IDs:
- Channel ID: Open Slack β Right-click channel β View channel details β Copy ID (starts with
C) - User ID: Click on user profile β More β Copy member ID (starts with
U)
- Channel ID: Open Slack β Right-click channel β View channel details β Copy ID (starts with
-
Pass these as inputs in your workflow (see below)
Setup for Webhook Method (Legacy):
- Add
DOCSYNC_SLACK_WEBHOOKsecret in your repo | Create webhook
Create .github/workflows/docsync-ai.yml in your repository:
name: π DocSync AI Documentation
on:
pull_request:
types: [closed]
branches:
- master # Change to 'main' if needed
issue_comment:
types: [created]
permissions:
contents: write
pull-requests: write
jobs:
docsync-on-merge:
if: github.event_name == 'pull_request' && github.event.pull_request.merged == true
uses: akash-deriv/shared-actions/.github/workflows/docsync-ai.yml@master
with:
trigger_type: 'merge'
base_branch: 'master'
pr_labels: 'documentation,automated,docsync-ai'
# Optional: Slack notifications via OAuth (recommended)
slack_channel_id: 'C01234567' # Your Slack channel ID
slack_user_id: 'U01234567' # User to mention (optional)
secrets:
DOCSYNC_GITHUB_TOKEN: ${{ secrets.DOCSYNC_GITHUB_TOKEN }}
DOCSYNC_ANTHROPIC_API_KEY: ${{ secrets.DOCSYNC_ANTHROPIC_API_KEY }}
# Optional: Legacy webhook support
# DOCSYNC_SLACK_WEBHOOK: ${{ secrets.DOCSYNC_SLACK_WEBHOOK }}
docsync-on-comment:
if: |
github.event_name == 'issue_comment' &&
github.event.issue.pull_request != null &&
(startsWith(github.event.comment.body, '@docbot') || startsWith(github.event.comment.body, 'docsync:'))
uses: akash-deriv/shared-actions/.github/workflows/docsync-ai.yml@master
with:
trigger_type: 'comment'
base_branch: 'master'
comment_body: ${{ github.event.comment.body }}
comment_pr_number: ${{ github.event.issue.number }}
secrets:
DOCSYNC_GITHUB_TOKEN: ${{ secrets.DOCSYNC_GITHUB_TOKEN }}
DOCSYNC_ANTHROPIC_API_KEY: ${{ secrets.DOCSYNC_ANTHROPIC_API_KEY }}Simply merge your PR - DocSync AI will automatically analyze changes and create a documentation PR if needed.
On any DocSync AI PR, use the @docbot command interface for controlled documentation updates:
π― Command Examples:
@docbot update readme
@docbot clarify auth section
@docbot add example for API authentication
@docbot expand installation steps
@docbot fix typo in configuration section
@docbot approve # Approve proposed changes
@docbot reject # Reject proposed changes
@docbot revert last change
Legacy format (still supported):
docsync: Add installation instructions for Windows users
Features:
- β¨ Structured commands - Clear, predictable interface (
@docbot <action> <target>) - π― Specific actions - Update, clarify, add examples, expand, fix, or revert
- π Approval workflow - Review changes before they're committed with
@docbot approve/reject - π Revert capability - Undo changes with
@docbot revert last change - π Auto-guide - Each DocSync PR includes a comment with all available commands
- π€ AI-powered - Claude analyzes context and applies changes intelligently
Important:
- Commands MUST start with
@docbot(case-insensitive) - Only works on DocSync-generated PRs (with
docsync-aiorautomatedlabels) - AI makes the final decision - may reject, modify, or improve suggestions
- Provides quality control and sanitization of user input
- Changes require explicit approval before being committed (safer workflow)
- Merge Trigger: When PR merges β AI analyzes diff β Creates doc PR if significant changes detected β Posts @docbot usage guide
- Comment Trigger: When user comments
@docbot <command>β AI parses command β Generates changes β Shows diff for review - Approval Workflow: User reviews diff β Comments
@docbot approveto apply or@docbot rejectto discard β Changes are only committed after approval - AI Decision Making: Claude AI evaluates all suggestions and makes expert decisions on documentation quality
- Safety: Validates PRs, sanitizes input, only modifies documentation files, requires approval before committing
- Revert Support: Can undo changes with
@docbot revert last changefor easy rollback
See example-docsync-workflow.yml for a complete configuration example with detailed comments.
If you want to use the OAuth token method (recommended), follow these steps:
- Go to Slack API
- Click "Create New App" β "From scratch"
- Name your app: "DocSync AI" (or any name)
- Select your workspace
- In the left sidebar, click "OAuth & Permissions"
- Scroll to "Scopes" section
- Add Bot Token Scopes:
chat:write- Post messages to channelschat:write.public- (Optional) Post to public channels without joining
- Scroll to top of "OAuth & Permissions" page
- Click "Install to Workspace"
- Review permissions and click "Allow"
- Copy the "Bot User OAuth Token" (starts with
xoxb-)- Store this as
SLACK_OAUTH_TOKENin shared-actions repo secrets
- Store this as
- Open Slack desktop/web app
- Right-click on the channel where you want notifications
- Select "View channel details"
- Scroll down and copy the Channel ID (starts with
C)- Example:
C01234ABCDE - Use this as
slack_channel_idinput in workflow
- Example:
- Click on your profile picture in Slack
- Select "Profile"
- Click "More" (three dots)
- Select "Copy member ID" (starts with
U)- Example:
U01234ABCDE - Use this as
slack_user_idinput in workflow
- Example:
- Open the Slack channel
- Type
/invite @DocSync AI(or your app name) - The bot must be in the channel to post messages
In shared-actions repo:
Settings > Secrets and variables > Actions > Repository secrets
Add: SLACK_OAUTH_TOKEN = xoxb-your-token-here
In consuming repo workflow:
with:
slack_channel_id: 'C01234ABCDE' # Required
slack_user_id: 'U01234ABCDE' # Optional (for mentions)| Feature | OAuth Token (Recommended) | Webhook (Legacy) |
|---|---|---|
| Setup | One-time in shared-actions | Per repository |
| Security | Token stored centrally | URL per repo |
| Flexibility | Multiple channels, user mentions | Single channel |
| Maintenance | Easy to rotate token | Need to update all repos |
| User Mentions | β Yes (with User ID) |
- name: Post preview build comment
id: post_preview_build_comment
uses: "deriv-com/shared-actions/.github/actions/post_preview_build_comment@master"
with:
issue_number: ${{steps.pr_information.outputs.issue_number}}
head_sha: ${{github.event.workflow_run.head_sha}}