|
| 1 | +name: Check generated docs are up to date |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, reopened, synchronize, ready_for_review] |
| 6 | + |
| 7 | +permissions: |
| 8 | + contents: read |
| 9 | + |
| 10 | +jobs: |
| 11 | + check-docs: |
| 12 | + name: Verify generated docs are up to date |
| 13 | + runs-on: ubuntu-latest |
| 14 | + if: > |
| 15 | + !github.event.pull_request.draft && !( |
| 16 | + (github.actor == 'asyncapi-bot' && ( |
| 17 | + startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') || |
| 18 | + startsWith(github.event.pull_request.title, 'chore(release):') |
| 19 | + )) || |
| 20 | + (github.actor == 'asyncapi-bot-eve' && ( |
| 21 | + startsWith(github.event.pull_request.title, 'ci: update of files from global .github repo') || |
| 22 | + startsWith(github.event.pull_request.title, 'chore(release):') |
| 23 | + )) || |
| 24 | + (github.actor == 'allcontributors[bot]' && |
| 25 | + startsWith(github.event.pull_request.title, 'docs: add') |
| 26 | + ) |
| 27 | + ) |
| 28 | + steps: |
| 29 | + - name: Checkout repository |
| 30 | + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2 https://github.com/actions/checkout/releases/tag/v4.2.2 |
| 31 | + |
| 32 | + - name: Check package-lock version |
| 33 | + # This workflow is from our own org repo and safe to reference by 'master'. |
| 34 | + uses: asyncapi/.github/.github/actions/get-node-version-from-package-lock@master # //NOSONAR |
| 35 | + id: lockversion |
| 36 | + with: |
| 37 | + node-version: ${{ vars.NODE_VERSION }} |
| 38 | + |
| 39 | + - name: Use Node.js |
| 40 | + uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.2.0 https://github.com/actions/setup-node/commit/48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e |
| 41 | + with: |
| 42 | + node-version: "${{ steps.lockversion.outputs.version }}" |
| 43 | + |
| 44 | + - name: Install dependencies |
| 45 | + run: npm ci |
| 46 | + |
| 47 | + - name: Regenerate docs |
| 48 | + run: npm run generate:assets |
| 49 | + |
| 50 | + - name: Verify no doc drift |
| 51 | + run: | |
| 52 | + git diff --exit-code || { |
| 53 | + echo "::error::Generated docs are out of date. Run 'npm run generate:assets' locally and commit the result." |
| 54 | + exit 1 |
| 55 | + } |
0 commit comments