58 lines
1.6 KiB
YAML
58 lines
1.6 KiB
YAML
name: Document Generation
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
deployments: write
|
|
|
|
jobs:
|
|
precheck:
|
|
uses: alcionai/corso/.github/workflows/_filechange_checker.yml@main
|
|
|
|
Generate-Markdown:
|
|
needs: precheck
|
|
if: needs.precheck.outputs.fileschanged == 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
ref: ${{ github.event.pull_request.head.ref }}
|
|
|
|
- name: Setup Golang with cache
|
|
uses: magnetikonline/action-golang-cache@v3
|
|
with:
|
|
go-version-file: src/go.mod
|
|
|
|
# run the markdown generator
|
|
- name: Generate Markdown
|
|
working-directory: ./src
|
|
run: |
|
|
go run ./cmd/mdgen/mdgen.go generate
|
|
|
|
# migrate generated md files into /docs/docs/cli
|
|
- name: Move CLI .md to Docs
|
|
run: |
|
|
mkdir -p ./docs/docs/cli
|
|
mv ./src/cmd/mdgen/cli_markdown/* ./docs/docs/cli/
|
|
rm -R ./src/cmd/mdgen/cli_markdown/
|
|
|
|
# make a PR for the docs_autogen branch
|
|
- name: Make a PR For the `docs_autogen` Branch
|
|
uses: peter-evans/create-pull-request@v4
|
|
with:
|
|
commit-message: "Documentation Auto-Generation"
|
|
branch: docs_autogen
|
|
delete-branch: true
|
|
base: main
|
|
title: "Docs Auto-Generation"
|
|
|
|
# make sure it gets approved
|
|
- name: Auto approve
|
|
if: steps.cpr.outputs.pull-request-operation == 'created'
|
|
uses: juliangruber/approve-pull-request-action@v1
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
number: ${{ steps.cpr.outputs.pull-request-number }} |