From 5c1d0c403cc1695a16ff2cd2fab549eb52bccb7e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Flore-Th=C3=A9bault?= Date: Thu, 25 Mar 2021 15:59:27 +0100 Subject: [PATCH 1/7] Use build artifact for link checker --- .github/workflows/link-checker.yaml | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/.github/workflows/link-checker.yaml b/.github/workflows/link-checker.yaml index e282df73d6..104d62b6a6 100644 --- a/.github/workflows/link-checker.yaml +++ b/.github/workflows/link-checker.yaml @@ -11,7 +11,13 @@ # See: https://github.com/wjdp/htmltest name: linkchecker-pr-check -on: [push, pull_request] + +on: + workflow_run: + workflows: ["build-documentation-pr"] + types: + - completed + jobs: linkchecker: name: link checker @@ -29,9 +35,10 @@ jobs: key: refcache.json path: .cache/htmltest - - name: Build using Antora - id: antora-build - run: antora generate antora-playbook.yml + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: doc-content - name: Check internal and external links using htmltest id: validate-links From a2969a8fe31a4c91d4bd796ebd7887ea9196364c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Flore-Th=C3=A9bault?= Date: Thu, 25 Mar 2021 17:12:05 +0100 Subject: [PATCH 2/7] Looking at the behaviour of GitHub Actions, what takes the most time is to wait for a runner for a workflow. Once the workflow has a runner, we spend less time waiting for executors for each job. As a consequence, it makes sense to limit the number of *workflows* as much as possible, and to use the *jobs* for a proper reporting in GitHub. This commit is an attempt to have one workflow for PR, and one workflow for push. It implies some duplication of code but I guess this is the price to pay for less wait time. --- .../workflows/build-and-validate-on-pr.yaml | 155 ++++++++++++++++++ .../workflows/build-and-validate-on-push.yaml | 83 ++++++++++ .github/workflows/build-pr-docs.yaml | 39 ----- .github/workflows/link-checker.yaml | 45 ----- .github/workflows/publish-netlify.yaml | 65 -------- .github/workflows/unused-images.yaml | 20 --- .github/workflows/vale-on-pr.yaml | 28 ---- .github/workflows/vale-on-push.yaml | 26 --- 8 files changed, 238 insertions(+), 223 deletions(-) create mode 100644 .github/workflows/build-and-validate-on-pr.yaml create mode 100644 .github/workflows/build-and-validate-on-push.yaml delete mode 100644 .github/workflows/build-pr-docs.yaml delete mode 100644 .github/workflows/link-checker.yaml delete mode 100644 .github/workflows/publish-netlify.yaml delete mode 100644 .github/workflows/unused-images.yaml delete mode 100644 .github/workflows/vale-on-pr.yaml delete mode 100644 .github/workflows/vale-on-push.yaml diff --git a/.github/workflows/build-and-validate-on-pr.yaml b/.github/workflows/build-and-validate-on-pr.yaml new file mode 100644 index 0000000000..e9ad3d85db --- /dev/null +++ b/.github/workflows/build-and-validate-on-pr.yaml @@ -0,0 +1,155 @@ +# +# Copyright (c) 2020 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# + +name: Build and validate documentation on pull request +on: + - pull_request +jobs: + build: + name: Build the documentation + runs-on: ubuntu-20.04 + container: "quay.io/eclipse/che-docs:latest" + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build using antora + id: antora-build + run: CI=true antora generate antora-playbook.yml --stacktrace + + - name: Upload artifact doc-content + uses: actions/upload-artifact@v2 + with: + name: doc-content + path: build/site + + - name: Store PR info + run: | + echo "${{ github.event.number }}" > PR_NUMBER + echo "${{ github.event.pull_request.head.sha }}" > PR_SHA + + - name: Upload artifact pull-request-number + uses: actions/upload-artifact@v2 + with: + name: pull-request-number + path: PR_NUMBER + + - name: Upload artifact pull-request-sha + uses: actions/upload-artifact@v2 + with: + name: pull-request-sha + path: PR_SHA + + htmltest: + name: link checker # This name is set as mandatory in the GitHub configuration. + runs-on: ubuntu-20.04 + container: "quay.io/eclipse/che-docs:latest" + needs: build + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Cache htmltest status code of checked external URLs # See: https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows + uses: actions/cache@v2 + env: + cache-name: cache-htmltest + with: + key: refcache.json + path: .cache/htmltest + + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: doc-content + + - name: Check internal and external links using htmltest + id: validate-links + run: htmltest + + publish: + name: Publish + runs-on: ubuntu-20.04 + needs: build + steps: + - name: download doc artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + name: doc-content + path: content + + - name: PR number + uses: dawidd6/action-download-artifact@v2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + name: pull-request-number + + - name: Grab pull request number + run: | + pr_number=$(cat "PR_NUMBER") + if ! [[ "$pr_number" =~ ^[0-9]+$ ]]; then + echo "pr number invalid" + exit 1 + fi + echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV + + - name: PR sha + uses: dawidd6/action-download-artifact@v2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + name: pull-request-sha + + - name: Grab pull request sha1 + run: | + pr_sha=$(cat "PR_SHA") + echo "PR_SHA=$pr_sha" >> $GITHUB_ENV + + - name: Publish + uses: netlify/actions/cli@master + id: netlify-publish + with: + args: deploy --dir=content --functions=functions + env: + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + + - name: "Comment PR" + uses: actions/github-script@v3.0.0 + with: + script: | + const { repo: { owner, repo } } = context; + const netlifyUrl = '${{ steps.netlify-publish.outputs.NETLIFY_URL }}'; + await github.repos.createCommitStatus({ owner, repo, sha: process.env.PR_SHA, state: "success", target_url: netlifyUrl, description: "Browse PR documentation online", context: "browse built doc"}) + + vale-diff: + name: Validate language on new and modified files in PR + runs-on: ubuntu-20.04 + container: "quay.io/eclipse/che-docs:latest" + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + + - name: Vale + run: | + vale -v + echo "Changed files, in comparison to branch $GITHUB_BASE_REF" + git diff --name-only --diff-filter=AM origin/$GITHUB_BASE_REF + vale $(git diff --name-only --diff-filter=AM origin/$GITHUB_BASE_REF) + + unusedimages: + name: Report unused images + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Detect Unused Images + run: tools/detect-unused-images.sh diff --git a/.github/workflows/build-and-validate-on-push.yaml b/.github/workflows/build-and-validate-on-push.yaml new file mode 100644 index 0000000000..17e6017be9 --- /dev/null +++ b/.github/workflows/build-and-validate-on-push.yaml @@ -0,0 +1,83 @@ +# +# Copyright (c) 2020 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# + +# GitHub Actions configuration file for htmltest +# See: https://github.com/wjdp/htmltest + +name: Build and validate documentation on push +on: + - push +jobs: + build: + name: Build the documentation + runs-on: ubuntu-20.04 + container: "quay.io/eclipse/che-docs:latest" + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Build using antora + id: antora-build + run: CI=true antora generate antora-playbook.yml --stacktrace + + - name: Upload artifact + uses: actions/upload-artifact@v2 + with: + name: doc-content + path: build/site + + htmltest: + name: link checker # This name is set as mandatory in the GitHub configuration. + runs-on: ubuntu-20.04 + container: "quay.io/eclipse/che-docs:latest" + needs: build + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Cache htmltest status code of checked external URLs # See: https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows + uses: actions/cache@v2 + env: + cache-name: cache-htmltest + with: + key: refcache.json + path: .cache/htmltest + + - name: Download artifacts + uses: actions/download-artifact@v2 + with: + name: doc-content + + - name: Check internal and external links using htmltest + id: validate-links + run: htmltest + + vale-all-content: + name: Validate style on all content on push + runs-on: ubuntu-20.04 + container: "quay.io/eclipse/che-docs:latest" + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + - name: Vale + run: | + vale -v + vale . + + unusedimages: + name: Report unused images + runs-on: ubuntu-20.04 + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Detect Unused Images + run: tools/detect-unused-images.sh diff --git a/.github/workflows/build-pr-docs.yaml b/.github/workflows/build-pr-docs.yaml deleted file mode 100644 index eac73b6747..0000000000 --- a/.github/workflows/build-pr-docs.yaml +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright (c) 2020 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# - -name: build-documentation-pr -on: pull_request -jobs: - build: - name: Build the documentation - runs-on: ubuntu-20.04 - container: "quay.io/eclipse/che-docs:latest" - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: build - id: antora-build - run: | - antora generate antora-playbook.yml - - uses: actions/upload-artifact@v2 - with: - name: doc-content - path: build/site - - name: Store PR info - run: | - echo "${{ github.event.number }}" > PR_NUMBER - echo "${{ github.event.pull_request.head.sha }}" > PR_SHA - - uses: actions/upload-artifact@v2 - with: - name: pull-request-number - path: PR_NUMBER - - uses: actions/upload-artifact@v2 - with: - name: pull-request-sha - path: PR_SHA diff --git a/.github/workflows/link-checker.yaml b/.github/workflows/link-checker.yaml deleted file mode 100644 index 104d62b6a6..0000000000 --- a/.github/workflows/link-checker.yaml +++ /dev/null @@ -1,45 +0,0 @@ -# -# Copyright (c) 2020 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# - -# GitHub Actions configuration file for htmltest -# See: https://github.com/wjdp/htmltest - -name: linkchecker-pr-check - -on: - workflow_run: - workflows: ["build-documentation-pr"] - types: - - completed - -jobs: - linkchecker: - name: link checker - runs-on: ubuntu-20.04 - container: "quay.io/eclipse/che-docs:latest" - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Cache htmltest status code of checked external URLs # See: https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows - uses: actions/cache@v2 - env: - cache-name: cache-htmltest - with: - key: refcache.json - path: .cache/htmltest - - - name: Download artifacts - uses: actions/download-artifact@v2 - with: - name: doc-content - - - name: Check internal and external links using htmltest - id: validate-links - run: htmltest diff --git a/.github/workflows/publish-netlify.yaml b/.github/workflows/publish-netlify.yaml deleted file mode 100644 index 36bd2dfe63..0000000000 --- a/.github/workflows/publish-netlify.yaml +++ /dev/null @@ -1,65 +0,0 @@ -# -# Copyright (c) 2020 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# - -name: Publish Doc Content - -on: - workflow_run: - workflows: ["build-documentation-pr"] - types: - - completed - -jobs: - publish: - name: publish - runs-on: ubuntu-20.04 - steps: - - name: download doc artifact - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - name: doc-content - path: content - - name: PR number - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - name: pull-request-number - - name: Grab pull request number - run: | - pr_number=$(cat "PR_NUMBER") - if ! [[ "$pr_number" =~ ^[0-9]+$ ]]; then - echo "pr number invalid" - exit 1 - fi - echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV - - name: PR sha - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - name: pull-request-sha - - name: Grab pull request sha1 - run: | - pr_sha=$(cat "PR_SHA") - echo "PR_SHA=$pr_sha" >> $GITHUB_ENV - - name: Publish - uses: netlify/actions/cli@master - id: netlify-publish - with: - args: deploy --dir=content --functions=functions - env: - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} - - name: 'Comment PR' - uses: actions/github-script@v3.0.0 - with: - script: | - const { repo: { owner, repo } } = context; - const netlifyUrl = '${{ steps.netlify-publish.outputs.NETLIFY_URL }}'; - await github.repos.createCommitStatus({ owner, repo, sha: process.env.PR_SHA, state: "success", target_url: netlifyUrl, description: "Browse PR documentation online", context: "browse built doc"}) diff --git a/.github/workflows/unused-images.yaml b/.github/workflows/unused-images.yaml deleted file mode 100644 index 4cba3d0d07..0000000000 --- a/.github/workflows/unused-images.yaml +++ /dev/null @@ -1,20 +0,0 @@ -# -# Copyright (c) 2020 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# - -name: unused-images-pr-check -on: [push, pull_request] -jobs: - linkchecker: - name: unused-images - runs-on: ubuntu-20.04 - steps: - - name: Checkout code - uses: actions/checkout@v2 - - name: Detect Unused Images - run: tools/detect-unused-images.sh diff --git a/.github/workflows/vale-on-pr.yaml b/.github/workflows/vale-on-pr.yaml deleted file mode 100644 index e2eb2b6630..0000000000 --- a/.github/workflows/vale-on-pr.yaml +++ /dev/null @@ -1,28 +0,0 @@ -# -# Copyright (c) 2021 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# - -name: vale-pr-check -on: - - pull_request -jobs: - vale-diff: - name: Validate style on new and modified files in PR - runs-on: ubuntu-20.04 - container: "quay.io/eclipse/che-docs:latest" - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Vale - run: | - vale -v - echo "Changed files, in comparison to branch $GITHUB_BASE_REF" - git diff --name-only --diff-filter=AM origin/$GITHUB_BASE_REF - vale $(git diff --name-only --diff-filter=AM origin/$GITHUB_BASE_REF) diff --git a/.github/workflows/vale-on-push.yaml b/.github/workflows/vale-on-push.yaml deleted file mode 100644 index 886f990ccf..0000000000 --- a/.github/workflows/vale-on-push.yaml +++ /dev/null @@ -1,26 +0,0 @@ -# -# Copyright (c) 2021 Red Hat, Inc. -# This program and the accompanying materials are made -# available under the terms of the Eclipse Public License 2.0 -# which is available at https://www.eclipse.org/legal/epl-2.0/ -# -# SPDX-License-Identifier: EPL-2.0 -# - -name: vale-push-check -on: - - push -jobs: - vale-all-content: - name: Validate style on all content on push - runs-on: ubuntu-20.04 - container: "quay.io/eclipse/che-docs:latest" - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - name: Vale - run: | - vale -v - vale . From bed55a26dd2a7ea597e8a34d146d1cdcc859fcd0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Flore-Th=C3=A9bault?= Date: Fri, 26 Mar 2021 10:14:34 +0100 Subject: [PATCH 3/7] Minimize the number of workflows AND jobs --- .../workflows/build-and-validate-on-pr.yaml | 129 +++++------------- .github/workflows/publish-netlify.yml | 74 ++++++++++ 2 files changed, 111 insertions(+), 92 deletions(-) create mode 100644 .github/workflows/publish-netlify.yml diff --git a/.github/workflows/build-and-validate-on-pr.yaml b/.github/workflows/build-and-validate-on-pr.yaml index e9ad3d85db..ce77ca4640 100644 --- a/.github/workflows/build-and-validate-on-pr.yaml +++ b/.github/workflows/build-and-validate-on-pr.yaml @@ -7,12 +7,12 @@ # SPDX-License-Identifier: EPL-2.0 # -name: Build and validate documentation on pull request +name: Build and validate PR on: - pull_request jobs: build: - name: Build the documentation + name: Build and validate the documentation runs-on: ubuntu-20.04 container: "quay.io/eclipse/che-docs:latest" steps: @@ -29,31 +29,36 @@ jobs: name: doc-content path: build/site - - name: Store PR info + - name: Store PR info for publish-netlify run: | echo "${{ github.event.number }}" > PR_NUMBER echo "${{ github.event.pull_request.head.sha }}" > PR_SHA - - name: Upload artifact pull-request-number + - name: Upload artifact pull-request-number for publish-netlify uses: actions/upload-artifact@v2 with: name: pull-request-number path: PR_NUMBER - - name: Upload artifact pull-request-sha + - name: Upload artifact pull-request-sha for publish-netlify uses: actions/upload-artifact@v2 with: name: pull-request-sha path: PR_SHA - htmltest: - name: link checker # This name is set as mandatory in the GitHub configuration. - runs-on: ubuntu-20.04 - container: "quay.io/eclipse/che-docs:latest" - needs: build - steps: - - name: Checkout code - uses: actions/checkout@v2 + # htmltest: + # name: link checker # This name is set as mandatory in the GitHub configuration. + # runs-on: ubuntu-20.04 + # container: "quay.io/eclipse/che-docs:latest" + # needs: build + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 + + # - name: Download artifacts + # uses: actions/download-artifact@v2 + # with: + # name: doc-content - name: Cache htmltest status code of checked external URLs # See: https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows uses: actions/cache@v2 @@ -63,93 +68,33 @@ jobs: key: refcache.json path: .cache/htmltest - - name: Download artifacts - uses: actions/download-artifact@v2 - with: - name: doc-content - - name: Check internal and external links using htmltest id: validate-links run: htmltest - publish: - name: Publish - runs-on: ubuntu-20.04 - needs: build - steps: - - name: download doc artifact - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - name: doc-content - path: content - - - name: PR number - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - name: pull-request-number - - - name: Grab pull request number - run: | - pr_number=$(cat "PR_NUMBER") - if ! [[ "$pr_number" =~ ^[0-9]+$ ]]; then - echo "pr number invalid" - exit 1 - fi - echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV - - - name: PR sha - uses: dawidd6/action-download-artifact@v2 - with: - workflow: ${{ github.event.workflow_run.workflow_id }} - name: pull-request-sha - - - name: Grab pull request sha1 - run: | - pr_sha=$(cat "PR_SHA") - echo "PR_SHA=$pr_sha" >> $GITHUB_ENV - - - name: Publish - uses: netlify/actions/cli@master - id: netlify-publish - with: - args: deploy --dir=content --functions=functions - env: - NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} - NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + # unusedimages: + # name: Report unused images + # runs-on: ubuntu-20.04 + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 - - name: "Comment PR" - uses: actions/github-script@v3.0.0 - with: - script: | - const { repo: { owner, repo } } = context; - const netlifyUrl = '${{ steps.netlify-publish.outputs.NETLIFY_URL }}'; - await github.repos.createCommitStatus({ owner, repo, sha: process.env.PR_SHA, state: "success", target_url: netlifyUrl, description: "Browse PR documentation online", context: "browse built doc"}) - - vale-diff: - name: Validate language on new and modified files in PR - runs-on: ubuntu-20.04 - container: "quay.io/eclipse/che-docs:latest" - steps: - - name: Checkout code - uses: actions/checkout@v2 - with: - fetch-depth: 0 + - name: Report Unused Images + run: tools/detect-unused-images.sh - - name: Vale + # vale-diff: + # name: Validate language on new and modified files in PR + # runs-on: ubuntu-20.04 + # container: "quay.io/eclipse/che-docs:latest" + # steps: + # - name: Checkout code + # uses: actions/checkout@v2 + # with: + # fetch-depth: 0 + + - name: Validate language on files added or modified run: | vale -v echo "Changed files, in comparison to branch $GITHUB_BASE_REF" git diff --name-only --diff-filter=AM origin/$GITHUB_BASE_REF vale $(git diff --name-only --diff-filter=AM origin/$GITHUB_BASE_REF) - - unusedimages: - name: Report unused images - runs-on: ubuntu-20.04 - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Detect Unused Images - run: tools/detect-unused-images.sh diff --git a/.github/workflows/publish-netlify.yml b/.github/workflows/publish-netlify.yml new file mode 100644 index 0000000000..b12bf33cd3 --- /dev/null +++ b/.github/workflows/publish-netlify.yml @@ -0,0 +1,74 @@ +--- +# +# Copyright (c) 2020 Red Hat, Inc. +# This program and the accompanying materials are made +# available under the terms of the Eclipse Public License 2.0 +# which is available at https://www.eclipse.org/legal/epl-2.0/ +# +# SPDX-License-Identifier: EPL-2.0 +# + +# NOTE: Because this worklow is using secrets, it cannot run directly on a pull-request workflow, which is running in the context of the forked repository. + +name: Publish doc-content using netlify + +on: + workflow_run: + workflows: ["build-documentation-pr"] + types: + - completed + +jobs: + publish: + name: Publish doc-content using netlify + runs-on: ubuntu-20.04 + steps: + - name: Download doc-content artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + name: doc-content + path: content + + - name: Download pull-request-number artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + name: pull-request-number + + - name: Set PR_NUMBER variable + run: | + pr_number=$(cat "PR_NUMBER") + if ! [[ "$pr_number" =~ ^[0-9]+$ ]]; then + echo "pr number invalid" + exit 1 + fi + echo "PR_NUMBER=$pr_number" >> $GITHUB_ENV + + - name: Download pull-request-sha artifact + uses: dawidd6/action-download-artifact@v2 + with: + workflow: ${{ github.event.workflow_run.workflow_id }} + name: pull-request-sha + + - name: Set PR_SHA variable + run: | + pr_sha=$(cat "PR_SHA") + echo "PR_SHA=$pr_sha" >> $GITHUB_ENV + + - name: Publish doc-content using netlify + uses: netlify/actions/cli@master + id: netlify-publish + with: + args: deploy --dir=content --functions=functions + env: + NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }} + NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }} + + - name: Comment the pull-request + uses: actions/github-script@v3.0.0 + with: + script: | + const { repo: { owner, repo } } = context; + const netlifyUrl = '${{ steps.netlify-publish.outputs.NETLIFY_URL }}'; + await github.repos.createCommitStatus({ owner, repo, sha: process.env.PR_SHA, state: "success", target_url: netlifyUrl, description: "Browse PR documentation online", context: "browse built doc"}) From 1b07f9e80d48bc4c2330779b7e2ab0fc1fde3afc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Flore-Th=C3=A9bault?= Date: Fri, 26 Mar 2021 10:16:06 +0100 Subject: [PATCH 4/7] Remove che.yml workflow which is not functional --- .github/workflows/che.yaml | 16 ---------------- 1 file changed, 16 deletions(-) delete mode 100644 .github/workflows/che.yaml diff --git a/.github/workflows/che.yaml b/.github/workflows/che.yaml deleted file mode 100644 index 548bfda120..0000000000 --- a/.github/workflows/che.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# Add Che link on PRs -name: che - -on: - pull_request: - types: [opened, synchronize] - -jobs: - add-link: - runs-on: ubuntu-latest - steps: - - name: Eclipse Che Pull Request Check - id: che-pr-check-gh-action - uses: benoitf/che-pr-check-gh-action@master - with: - github-token: ${{ secrets.GITHUB_TOKEN }} From 1454cbfd289f4517199d25c13ca50b49c7edb0f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Flore-Th=C3=A9bault?= Date: Fri, 26 Mar 2021 10:40:10 +0100 Subject: [PATCH 5/7] Fixes --- .github/workflows/build-and-validate-on-pr.yaml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-validate-on-pr.yaml b/.github/workflows/build-and-validate-on-pr.yaml index ce77ca4640..0769ad16a5 100644 --- a/.github/workflows/build-and-validate-on-pr.yaml +++ b/.github/workflows/build-and-validate-on-pr.yaml @@ -7,17 +7,19 @@ # SPDX-License-Identifier: EPL-2.0 # -name: Build and validate PR +name: Build and validate on: - pull_request jobs: build: - name: Build and validate the documentation + name: Build and validate runs-on: ubuntu-20.04 container: "quay.io/eclipse/che-docs:latest" steps: - name: Checkout code uses: actions/checkout@v2 + with: + fetch-depth: 0 # Necessary for git diff in vale step - name: Build using antora id: antora-build @@ -68,7 +70,7 @@ jobs: key: refcache.json path: .cache/htmltest - - name: Check internal and external links using htmltest + - name: link checker # GitHub is configured to enforce checks with this name id: validate-links run: htmltest From 2eac3115bb436afa79f01703b1cc5c6f0a9023f6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Flore-Th=C3=A9bault?= Date: Fri, 26 Mar 2021 10:51:21 +0100 Subject: [PATCH 6/7] Fixes --- .github/workflows/build-and-validate-on-pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-validate-on-pr.yaml b/.github/workflows/build-and-validate-on-pr.yaml index 0769ad16a5..202fb71a45 100644 --- a/.github/workflows/build-and-validate-on-pr.yaml +++ b/.github/workflows/build-and-validate-on-pr.yaml @@ -18,8 +18,8 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v2 - with: - fetch-depth: 0 # Necessary for git diff in vale step + with: + fetch-depth: 0 # Necessary for git diff in vale step - name: Build using antora id: antora-build From 3f68b1f3d62296961256d854ab709567f2985805 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabrice=20Flore-Th=C3=A9bault?= Date: Fri, 26 Mar 2021 10:56:46 +0100 Subject: [PATCH 7/7] Fix job name --- .github/workflows/build-and-validate-on-pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-and-validate-on-pr.yaml b/.github/workflows/build-and-validate-on-pr.yaml index 202fb71a45..3d7ef13c79 100644 --- a/.github/workflows/build-and-validate-on-pr.yaml +++ b/.github/workflows/build-and-validate-on-pr.yaml @@ -12,7 +12,7 @@ on: - pull_request jobs: build: - name: Build and validate + name: link checker # This job name is set as mandatory in the GitHub configuration. runs-on: ubuntu-20.04 container: "quay.io/eclipse/che-docs:latest" steps: @@ -70,7 +70,7 @@ jobs: key: refcache.json path: .cache/htmltest - - name: link checker # GitHub is configured to enforce checks with this name + - name: Validate links using htmltest id: validate-links run: htmltest