|  | 
|  | 1 | +--- | 
|  | 2 | + | 
|  | 3 | +name: Lint documentation | 
|  | 4 | + | 
|  | 5 | +on: | 
|  | 6 | +  workflow_call: | 
|  | 7 | +    inputs: | 
|  | 8 | +      antsibull-log-upload: | 
|  | 9 | +        description: | | 
|  | 10 | +          If 'true', the antsibull-doc log will be uploaded as an artifact. | 
|  | 11 | +        required: false | 
|  | 12 | +        type: boolean | 
|  | 13 | +        default: false | 
|  | 14 | + | 
|  | 15 | +jobs: | 
|  | 16 | +  lint-ansible-docs: | 
|  | 17 | +    runs-on: ubuntu-latest | 
|  | 18 | +    permissions: | 
|  | 19 | +      contents: read | 
|  | 20 | +    steps: | 
|  | 21 | +      - name: Configure environment | 
|  | 22 | +        id: vars | 
|  | 23 | +        uses: actions/github-script@v6 | 
|  | 24 | +        with: | 
|  | 25 | +          script: | | 
|  | 26 | +            name = process.env.GITHUB_REPOSITORY.split('/')[1] | 
|  | 27 | +            path = name.replace('.', '/') | 
|  | 28 | +
 | 
|  | 29 | +            core.exportVariable('ANSIBLE_COLLECTIONS_PATHS', process.env.GITHUB_WORKSPACE) | 
|  | 30 | +
 | 
|  | 31 | +            const checkoutPath = `ansible_collections/${path}` | 
|  | 32 | +            core.setOutput('checkout-path', checkoutPath) | 
|  | 33 | +
 | 
|  | 34 | +      - name: Set up Python | 
|  | 35 | +        uses: actions/setup-python@v4 | 
|  | 36 | +        with: | 
|  | 37 | +          python-version: 3.11 | 
|  | 38 | + | 
|  | 39 | +      - name: Install Ansible | 
|  | 40 | +        run: pip install ansible-core | 
|  | 41 | + | 
|  | 42 | +      - name: Display Ansible details | 
|  | 43 | +        run: ansible --version | 
|  | 44 | + | 
|  | 45 | +      - name: Checkout project | 
|  | 46 | +        uses: actions/checkout@v3 | 
|  | 47 | +        with: | 
|  | 48 | +          path: ${{ steps.vars.outputs.checkout-path }} | 
|  | 49 | + | 
|  | 50 | +      - name: Install Python requirements | 
|  | 51 | +        run: pip install -r ${{ steps.vars.outputs.checkout-path }}/docsbuild/requirements.txt | 
|  | 52 | +         | 
|  | 53 | +      - name: Execute antsibull-docs with --fail-on-error | 
|  | 54 | +        run: | | 
|  | 55 | +          mkdir -p ${{ steps.vars.outputs.checkout-path }}/docsbuild/temp-rst | 
|  | 56 | +          chmod og-w ${{ steps.vars.outputs.checkout-path }}/docsbuild/temp-rst | 
|  | 57 | +          antsibull-docs \ | 
|  | 58 | +            --config-file ${{ steps.vars.outputs.checkout-path }}/docsbuild/antsibull-docs.cfg \ | 
|  | 59 | +            collection \ | 
|  | 60 | +            --use-current \ | 
|  | 61 | +            --squash-hierarchy \ | 
|  | 62 | +            --dest-dir temp-rst \ | 
|  | 63 | +            --fail-on-error \ | 
|  | 64 | +            cloudera.cloud | 
|  | 65 | +        continue-on-error: true | 
|  | 66 | + | 
|  | 67 | +      - name: Upload antsibull-doc log artifact | 
|  | 68 | +        if: fromJSON(inputs.antsibull-log-upload) | 
|  | 69 | +        uses: actions/upload-artifact@v3 | 
|  | 70 | +        with: | 
|  | 71 | +          path: ${{ steps.vars.outputs.checkout-path }}/docsbuild/antsibull.log | 
|  | 72 | +          name: antsibull-${{ github.sha }}.log | 
|  | 73 | +          retention-days: 7 | 
0 commit comments