From fb6b49f98691c3388be3fa1ca05661b5df217d35 Mon Sep 17 00:00:00 2001 From: bakerboy448 <55419169+bakerboy448@users.noreply.github.com> Date: Mon, 26 Jun 2023 18:30:40 -0500 Subject: [PATCH] (chore): GHA - Various (#1400) --- .github/workflows/conflicts.yml | 18 ++++++++++ .github/workflows/deploy.yml | 40 +++++++++++++--------- .github/workflows/labeler.yml | 6 +++- .github/workflows/lint-editor.yml | 14 ++++++++ .github/workflows/lint-markdown.yml | 26 ++++++++++++++ .github/workflows/lint-yaml.yml | 26 ++++++++++++++ .github/workflows/lint.yml | 41 ----------------------- .github/workflows/metadata-validation.yml | 2 +- yamllint.yml | 7 ++++ 9 files changed, 122 insertions(+), 58 deletions(-) create mode 100644 .github/workflows/conflicts.yml create mode 100644 .github/workflows/lint-editor.yml create mode 100644 .github/workflows/lint-markdown.yml create mode 100644 .github/workflows/lint-yaml.yml delete mode 100644 .github/workflows/lint.yml create mode 100644 yamllint.yml diff --git a/.github/workflows/conflicts.yml b/.github/workflows/conflicts.yml new file mode 100644 index 000000000..2c8723089 --- /dev/null +++ b/.github/workflows/conflicts.yml @@ -0,0 +1,18 @@ +name: Label Conflicts + +on: [push, pull_request] + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - name: Check out code + uses: actions/checkout@v2 + + - name: Label Merge Conflicts + uses: mschilde/auto-label-merge-conflicts@master + with: + CONFLICT_LABEL_NAME: "Status: Conflicted" + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + MAX_RETRIES: 5 + WAIT_MS: 5000 diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d4b84f034..aecda8993 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,39 +1,49 @@ -name: Build mkdocs and deploy to GitHub Pages +name: Build and Deploy Docs on: [push, pull_request] jobs: - build: name: Build docs runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3.5.3 - - uses: actions/setup-python@v4.6.1 + - name: Checkout repository + uses: actions/checkout@v3.5.3 + - name: Set up Python + uses: actions/setup-python@v4.6.1 with: python-version: 3.x - - uses: actions/cache@v3.3.1 + - name: Cache dependencies + uses: actions/cache@v3.3.1 with: - key: ${{ github.ref }} path: .cache - - run: pip install -r docs/requirements.txt - - run: mkdocs build - + key: ${{ runner.os }}-build-${{ hashFiles('docs/requirements.txt') }} + - name: Install dependencies + run: pip install -r docs/requirements.txt + - name: Build documentation + run: mkdocs build deploy: if: github.event_name == 'push' && contains(fromJson('["refs/heads/master", "refs/heads/main"]'), github.ref) needs: build name: Deploy docs runs-on: ubuntu-latest + permissions: + contents: write steps: - - uses: actions/checkout@v3.5.3 + - name: Checkout repository + uses: actions/checkout@v3.5.3 with: fetch-depth: '0' - - uses: actions/setup-python@v4.6.1 + - name: Set up Python + uses: actions/setup-python@v4.6.1 with: python-version: 3.x - - uses: actions/cache@v3.3.1 + - name: Cache dependencies + uses: actions/cache@v3.3.1 with: - key: ${{ github.ref }} path: .cache - - run: pip install -r docs/requirements.txt - - run: mkdocs gh-deploy --force + key: ${{ runner.os }}-build-${{ hashFiles('docs/requirements.txt') }} + - name: Install dependencies + run: pip install -r docs/requirements.txt + - name: Deploy to GitHub Pages + run: mkdocs gh-deploy --force diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 857cfb4a7..6ffdfc169 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -1,7 +1,11 @@ -name: "Pull Request Labeler" +name: Label Pull Requests + on: - pull_request_target +inputs: + sync-labels: true + jobs: triage: permissions: diff --git a/.github/workflows/lint-editor.yml b/.github/workflows/lint-editor.yml new file mode 100644 index 000000000..408142d8f --- /dev/null +++ b/.github/workflows/lint-editor.yml @@ -0,0 +1,14 @@ +name: Lint - EditorConfig + +on: [push, pull_request] + +jobs: + editorconfig-checker: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3.5.3 + - name: editorconfig-checker + run: | + docker run --rm \ + -v "${GITHUB_WORKSPACE}":/check \ + mstruebing/editorconfig-checker diff --git a/.github/workflows/lint-markdown.yml b/.github/workflows/lint-markdown.yml new file mode 100644 index 000000000..3287fff80 --- /dev/null +++ b/.github/workflows/lint-markdown.yml @@ -0,0 +1,26 @@ +name: Lint - Markdown + +on: + push: + paths: + - "**/*.md" + - ".markdownlint.jsonc" + pull_request: + paths: + - "**/*.md" + - ".markdownlint.jsonc" + +jobs: + markdownlint: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3.5.3 + - name: markdownlint + run: | + find "${GITHUB_WORKSPACE}" -name '*.md' -exec \ + docker run --rm \ + -v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" \ + -v "${GITHUB_WORKSPACE}/.markdownlint.jsonc":"/config/.markdownlint.jsonc" \ + markdownlint/markdownlint \ + -c "/config/.markdownlint.jsonc" \ + {} + diff --git a/.github/workflows/lint-yaml.yml b/.github/workflows/lint-yaml.yml new file mode 100644 index 000000000..287f422dd --- /dev/null +++ b/.github/workflows/lint-yaml.yml @@ -0,0 +1,26 @@ +name: Lint - YAML + +on: + push: + paths: + - "**/*.yml" + pull_request: + paths: + - "**/*.yml" + +jobs: + yamllint: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3.5.3 + + - name: Run yamllint + run: | + find "${GITHUB_WORKSPACE}" -name '*.yml' -exec \ + docker run --rm \ + -v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" \ + -w "${GITHUB_WORKSPACE}" \ + peterdavehello/yamllint \ + yamllint -c yamllint.yml \ + {} + diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml deleted file mode 100644 index 804390f71..000000000 --- a/.github/workflows/lint.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Lint - -on: [push, pull_request] - -jobs: - - editorconfig-checker: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3.5.3 - - name: editorconfig-checker - run: | - docker run --rm \ - -v "${GITHUB_WORKSPACE}":/check \ - mstruebing/editorconfig-checker - - markdownlint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3.5.3 - - name: markdownlint - run: | - find "${GITHUB_WORKSPACE}" -name '*.md' -exec \ - docker run --rm \ - -v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" \ - markdownlint/markdownlint \ - -r ~MD013,~MD033,~MD034,~MD046,~MD002,~MD041 \ - {} + - - yamllint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3.5.3 - - name: yamllint - run: | - find "${GITHUB_WORKSPACE}" -name '*.yaml' -o -name '*.yml' -exec \ - docker run --rm \ - -v "${GITHUB_WORKSPACE}":"${GITHUB_WORKSPACE}" \ - peterdavehello/yamllint \ - yamllint -d '{"extends":"default","rules":{"document-start":{"present":false},"line-length":"disable","truthy":{"check-keys":false}}}' \ - {} + diff --git a/.github/workflows/metadata-validation.yml b/.github/workflows/metadata-validation.yml index ff9501389..0be3db250 100644 --- a/.github/workflows/metadata-validation.yml +++ b/.github/workflows/metadata-validation.yml @@ -20,6 +20,6 @@ jobs: - uses: actions/checkout@v3.5.3 - uses: actions/setup-python@v4.6.1 with: - python-version: "3.x" + python-version: 3.x - run: pip install jsonschema - run: jsonschema -i metadata.json metadata.schema.json diff --git a/yamllint.yml b/yamllint.yml new file mode 100644 index 000000000..44bdcce06 --- /dev/null +++ b/yamllint.yml @@ -0,0 +1,7 @@ +extends: default +rules: + document-start: + present: false + line-length: disable + truthy: + check-keys: false