corso/.github/workflows/docgen.yml
Keepers 9357d6b6ac
swap over the remaining go setup scripts (#957)
## Type of change

- [x] 💻 CI/Deployment

## Issue(s)

* #790

## Test Plan

- [x] 💚 E2E
2022-09-27 17:12:14 +00:00

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 }}