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

Create update-markdown.yml #2601

Open
wants to merge 9 commits 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
70 changes: 70 additions & 0 deletions .github/workflows/update-md.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Update Markdown

on:
# Trigger on PR when cmd/** or sdk/** files change
pull_request:
branches:
- main
paths:
- "cmd/**"
- "sdk/**"

# Trigger on comment for manual updates
issue_comment:
types: [created]

# Add permissions block to allow reading PR comments
permissions:
contents: write
pull-requests: write
issues: read

jobs:
update_md:
# For pull_request event, always run
# For issue_comment event, only run if comment contains /update-md
if: >
github.event_name == 'pull_request' ||
(github.event_name == 'issue_comment' && contains(github.event.comment.body, '/update-md'))
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21'

- name: Build avalanche-cli
run: |
chmod +x ./scripts/build.sh
./scripts/build.sh

- name: Add avalanche to PATH
run: echo "${{ github.workspace }}/bin" >> $GITHUB_PATH

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.9"

- name: Generate CLI MD
run: python .github/scripts/cli_scraper.py

- name: Generate SDK MD
run: python .github/scripts/sdk_doc.py

- name: Commit files
uses: ChromeQ/[email protected]
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
files: |
cmd/commands.md
sdk/SDK.md
commit-message: "chore: Update MD files [skip ci]"
Loading