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

decouple tbdocs commenter #323

Merged
merged 3 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
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
53 changes: 53 additions & 0 deletions .github/workflows/docs-ci.yml
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
shamilovtim marked this conversation as resolved.
Show resolved Hide resolved

# 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
52 changes: 52 additions & 0 deletions .github/workflows/tbdocs-commenter.yml
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
33 changes: 0 additions & 33 deletions .github/workflows/tests-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -128,39 +128,6 @@ jobs:
env:
TEST_DWN_URL: http://localhost:3000

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

web5-spec:
runs-on: ubuntu-latest
steps:
Expand Down
Loading