generated from TBD54566975/tbd-project-template
-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* decouple tbdocs commenter * trigger comment * Decouple docs actions
- Loading branch information
Showing
3 changed files
with
105 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Docs Continuous Integration | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
tbdocs-reporter: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout source | ||
uses: actions/checkout@8e5e7e5ab8b370d6c329ec480221332ada57f0ab # v3.5.2 | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@64ed1c7eab4cce3362f8c340dee64e5eaeef8f7c # v3.6.0 | ||
with: | ||
node-version: 18 | ||
registry-url: https://registry.npmjs.org/ | ||
|
||
- name: Install latest npm | ||
run: npm install -g npm@latest | ||
|
||
- name: Install dependencies | ||
run: npm ci | ||
|
||
- name: Build all workspace packages | ||
run: npm run build | ||
|
||
- name: TBDocs Reporter | ||
id: tbdocs-reporter-protocol | ||
uses: TBD54566975/tbdocs@main | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
report_changed_scope_only: false | ||
fail_on_error: false | ||
entry_points: | | ||
- file: packages/api/src/index.ts | ||
docsReporter: api-extractor | ||
docsGenerator: typedoc-markdown | ||
- name: Save Artifacts | ||
uses: actions/upload-artifact@v3 | ||
if: always() | ||
with: | ||
name: tbdocs-reporter-output | ||
path: ./.tbdocs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
name: TBDocs Commenter | ||
|
||
on: | ||
workflow_run: | ||
workflows: ["Docs Continuous Integration"] | ||
types: | ||
- completed | ||
|
||
jobs: | ||
comment-action: | ||
name: TBDocs PR Comment | ||
runs-on: ubuntu-latest | ||
# runs only if it's triggered from a PR | ||
if: github.event.workflow_run.pull_requests[0].number != null | ||
|
||
steps: | ||
- name: Download TBDocs Report | ||
uses: dawidd6/action-download-artifact@v2 | ||
with: | ||
run_id: ${{ github.event.workflow_run.id }} | ||
name: tbdocs-reporter-output | ||
path: ./.tbdocs | ||
|
||
- name: Add footer to markdown report | ||
run: | | ||
report_file='.tbdocs/docs-report.md' | ||
head_sha="${{ github.event.workflow_run.pull_requests[0].head.sha }}" | ||
short_sha=${head_sha:0:7} | ||
timestamp=$(date -u +"%Y-%m-%dT%H:%M:%SZ") | ||
repo="${{ github.repository }}" | ||
sha_link="https://github.com/$repo/commit/$head_sha" | ||
footer_line="_TBDocs Report Updated at $timestamp [\`$short_sha\`]($sha_link)_" | ||
echo "---" >> $report_file | ||
echo $footer_line >> $report_file | ||
- name: Find Comment | ||
uses: peter-evans/find-comment@v2 | ||
id: fc | ||
with: | ||
issue-number: ${{ github.event.workflow_run.pull_requests[0].number }} | ||
comment-author: "github-actions[bot]" | ||
body-includes: TBDocs Report | ||
|
||
- name: Comment on PR | ||
uses: peter-evans/create-or-update-comment@v3 | ||
with: | ||
comment-id: ${{ steps.fc.outputs.comment-id }} | ||
issue-number: ${{ github.event.workflow_run.pull_requests[0].number }} | ||
edit-mode: replace | ||
body-path: .tbdocs/docs-report.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters