From 6ecef8709e97d95bdc28824b5a5f8a33efebfcbe Mon Sep 17 00:00:00 2001 From: Tim van Dijen <tvdijen@gmail.com> Date: Mon, 4 Jul 2022 21:47:27 +0200 Subject: [PATCH] Add job to trigger docs build --- .github/workflows/documentation.yml | 70 +++++++++++++++++++++++++++++ .github/workflows/php.yml | 8 ++-- .markdownlintignore | 1 + 3 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/documentation.yml create mode 100644 .markdownlintignore diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml new file mode 100644 index 000000000..287796fb4 --- /dev/null +++ b/.github/workflows/documentation.yml @@ -0,0 +1,70 @@ +name: Documentation + +on: + push: + branches: [ master, release-* ] + paths: + - '**.md' + pull_request: + branches: [ master, release-* ] + paths: + - '**.md' + +jobs: + quality: + name: Quality checks + runs-on: [ubuntu-latest] + + steps: + - name: Setup PHP, with composer and extensions + uses: shivammathur/setup-php@v2 #https://github.com/shivammathur/setup-php + with: + php-version: '8.0' + tools: composer:v2 + extensions: intl, mbstring, xml + + - name: Setup problem matchers for PHP + run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" + + - uses: actions/checkout@v3 + + - name: Get composer cache directory + id: composer-cache + run: echo "::set-output name=dir::$(composer config cache-files-dir)" + + - name: Cache composer dependencies + uses: actions/cache@v3 + with: + path: ${{ steps.composer-cache.outputs.dir }} + key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} + restore-keys: ${{ runner.os }}-composer- + + - name: Install Composer dependencies + run: composer install --no-progress --prefer-dist --optimize-autoloader + + - name: Lint markdown files + uses: nosborn/github-action-markdown-cli@v3.1.0 + with: + files: . + ignore_path: .markdownlintignore + + build: + name: Build documentation + needs: quality + runs-on: [ubuntu-latest] + + steps: + - name: Run docs build if any of markdown-files have changed + if: steps.changed-files-specific.outputs.any_changed == 'true' && github.event_name != 'pull_request' + uses: actions/github-script@v6 + with: + # Token has to be generated on a user account that controls the docs-repository. + # The _only_ scope to select is "Access public repositories", nothing more. + github-token: ${{ secrets.PAT_TOKEN }} + script: | + await github.rest.actions.createWorkflowDispatch({ + owner: 'simplesamlphp', + repo: 'docs', + workflow_id: 'mk_docs.yml', + ref: 'main' + }) diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml index ba59d41e9..a85f4aa08 100644 --- a/.github/workflows/php.yml +++ b/.github/workflows/php.yml @@ -37,7 +37,7 @@ jobs: git config --global core.autocrlf false git config --global core.eol lf - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get composer cache directory id: composer-cache @@ -91,7 +91,7 @@ jobs: - name: Setup problem matchers for PHP run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get composer cache directory id: composer-cache @@ -132,7 +132,7 @@ jobs: - name: Setup problem matchers for PHP run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get composer cache directory id: composer-cache @@ -170,7 +170,7 @@ jobs: - name: Setup problem matchers for PHP run: echo "::add-matcher::${{ runner.tool_cache }}/php.json" - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Get composer cache directory id: composer-cache diff --git a/.markdownlintignore b/.markdownlintignore new file mode 100644 index 000000000..140fada73 --- /dev/null +++ b/.markdownlintignore @@ -0,0 +1 @@ +vendor/* -- GitLab