From f4a7fd3ca995cc9a8f2cc71c8ef4fdd0a03692a8 Mon Sep 17 00:00:00 2001 From: Leah Antkiewicz Date: Thu, 29 Aug 2024 22:11:57 -0400 Subject: [PATCH] Adding yamlfix formatter --- .github/workflows/changelog-entry-check.yml | 41 +++++------ .github/workflows/code-quality.yml | 6 +- .github/workflows/docs-issue.yml | 15 +++-- .github/workflows/integration-tests.yml | 22 ++++-- .github/workflows/release.yml | 8 ++- .github/workflows/release_prep_hatch.yml | 37 ++++++---- .github/workflows/stale.yml | 1 + .github/workflows/unit-tests.yml | 10 ++- .github/workflows/version-bump.yml | 4 +- .pre-commit-config.yaml | 75 +++++++++++---------- yamlfix.toml | 5 ++ 11 files changed, 136 insertions(+), 88 deletions(-) create mode 100644 yamlfix.toml diff --git a/.github/workflows/changelog-entry-check.yml b/.github/workflows/changelog-entry-check.yml index 889c0995..e9a2dd9f 100644 --- a/.github/workflows/changelog-entry-check.yml +++ b/.github/workflows/changelog-entry-check.yml @@ -1,29 +1,30 @@ name: Changelog entry check on: - pull_request: - types: - - opened - - reopened - - labeled - - unlabeled - - synchronize + pull_request: + types: + - opened + - reopened + - labeled + - unlabeled + - synchronize defaults: - run: - shell: bash + run: + shell: bash permissions: - contents: read - pull-requests: write + contents: read + pull-requests: write jobs: - changelog-entry-check: - uses: dbt-labs/actions/.github/workflows/changelog-existence.yml@main - with: - changelog_comment: >- - Thank you for your pull request! We could not find a changelog entry for this change. - For details on how to document a change, see the - [dbt-postgres contributing guide](https://github.com/dbt-labs/dbt-postgres/blob/main/CONTRIBUTING.md). - skip_label: "Skip Changelog" - secrets: inherit + changelog-entry-check: + uses: dbt-labs/actions/.github/workflows/changelog-existence.yml@main + with: + changelog_comment: >- + Thank you for your pull request! We could not find a changelog entry for this + change. + For details on how to document a change, see the + [dbt-postgres contributing guide](https://github.com/dbt-labs/dbt-postgres/blob/main/CONTRIBUTING.md). + skip_label: "Skip Changelog" + secrets: inherit diff --git a/.github/workflows/code-quality.yml b/.github/workflows/code-quality.yml index 1ca2ded0..ed8d4d02 100644 --- a/.github/workflows/code-quality.yml +++ b/.github/workflows/code-quality.yml @@ -23,7 +23,8 @@ permissions: read-all # will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise concurrency: - group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }} + group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, + 'pull_request') && github.event.pull_request.head.ref || github.sha }} cancel-in-progress: true jobs: @@ -40,7 +41,8 @@ jobs: - name: Update Adapters and Core branches if: ${{ contains(github.event_name, 'workflow_') }} shell: bash - run: ./.github/scripts/update_dev_packages.sh ${{ inputs.dbt_adapters_branch }} "main" + run: ./.github/scripts/update_dev_packages.sh ${{ inputs.dbt_adapters_branch }} + "main" - name: Setup `hatch` uses: dbt-labs/dbt-adapters/.github/actions/setup-hatch@main diff --git a/.github/workflows/docs-issue.yml b/.github/workflows/docs-issue.yml index f49cf517..539844a3 100644 --- a/.github/workflows/docs-issue.yml +++ b/.github/workflows/docs-issue.yml @@ -7,20 +7,21 @@ # **when?** # When an issue is labeled `user docs` and is closed as completed. Can be labeled before or after the issue is closed. - name: Open issues in docs.getdbt.com repo when an issue is labeled run-name: "Open an issue in docs.getdbt.com for issue #${{ github.event.issue.number }}" on: issues: - types: [labeled, closed] + types: + - labeled + - closed defaults: run: shell: bash permissions: - issues: write # comments on issues + issues: write # comments on issues jobs: open_issues: @@ -35,7 +36,9 @@ jobs: (github.event.action == 'labeled' && github.event.label.name == 'user docs')) uses: dbt-labs/actions/.github/workflows/open-issue-in-repo.yml@main with: - issue_repository: "dbt-labs/docs.getdbt.com" - issue_title: "Docs Changes Needed from ${{ github.event.repository.name }} Issue #${{ github.event.issue.number }}" - issue_body: "At a minimum, update body to include a link to the page on docs.getdbt.com requiring updates and what part(s) of the page you would like to see updated." + issue_repository: "dbt-labs/docs.getdbt.com" + issue_title: "Docs Changes Needed from ${{ github.event.repository.name }} Issue\ + \ #${{ github.event.issue.number }}" + issue_body: "At a minimum, update body to include a link to the page on docs.getdbt.com\ + \ requiring updates and what part(s) of the page you would like to see updated." secrets: inherit diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 374908f4..d214336e 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -1,6 +1,8 @@ name: Integration Tests -run-name: "${{ (contains(github.event_name, 'workflow_') && inputs.name) || github.event_name }}: ${{ (contains(github.event_name, 'workflow_') && inputs.adapter_branch) || github.ref_name }} by @${{ github.actor }}" +run-name: "${{ (contains(github.event_name, 'workflow_') && inputs.name) || github.event_name }}:\ + \ ${{ (contains(github.event_name, 'workflow_') && inputs.adapter_branch) || github.ref_name }}\ + \ by @${{ github.actor }}" on: push: @@ -67,7 +69,8 @@ permissions: read-all # will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise concurrency: - group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }} + group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, + 'pull_request') && github.event.pull_request.head.ref || github.sha }} cancel-in-progress: true defaults: @@ -82,7 +85,12 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" services: postgres: @@ -147,8 +155,12 @@ jobs: strategy: fail-fast: false matrix: - platform: [ubuntu-22.04, macos-12] - python-version: ["3.8", "3.12"] + platform: + - ubuntu-22.04 + - macos-12 + python-version: + - "3.8" + - "3.12" steps: - name: "Check out repository" uses: actions/checkout@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bbf36399..0f3c82d1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -25,11 +25,12 @@ on: default: "3.12" permissions: - contents: write # this is the permission that allows creating a new release + contents: write # this is the permission that allows creating a new release # will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise concurrency: - group: "${{ github.workflow }}-${{ github.event_name }}-${{ inputs.version }}-${{ inputs.deploy-to }}" + group: "${{ github.workflow }}-${{ github.event_name }}-${{ inputs.version }}-${{\ + \ inputs.deploy-to }}" cancel-in-progress: true jobs: @@ -49,7 +50,8 @@ jobs: outputs: archive-name: ${{ steps.archive.outputs.name }} steps: - - name: "Checkout ${{ github.event.repository.name }}@${{ needs.release-prep.outputs.release-branch }}" + - name: "Checkout ${{ github.event.repository.name }}@${{ needs.release-prep.outputs.release-branch\ + \ }}" uses: actions/checkout@v4 with: ref: ${{ needs.release-prep.outputs.release-branch }} diff --git a/.github/workflows/release_prep_hatch.yml b/.github/workflows/release_prep_hatch.yml index 18d7637b..4d3abb57 100644 --- a/.github/workflows/release_prep_hatch.yml +++ b/.github/workflows/release_prep_hatch.yml @@ -31,7 +31,9 @@ # 1. Bump the version if it has not been bumped # 2. Generate the changelog (via changie) if there is no markdown file for this version name: "Release prep" -run-name: "Release prep: Generate changelog and bump to ${{ inputs.version }} for release to ${{ inputs.deploy-to }}" +run-name: "Release prep: Generate changelog and bump to ${{ inputs.version }} for\ + \ release to ${{ inputs.deploy-to }}" + on: workflow_call: inputs: @@ -59,7 +61,8 @@ on: description: "The SHA to be released" value: ${{ jobs.release.outputs.sha }} changelog-path: - description: "The path to the changelog from the repo root for this version, e.g. .changes/1.8.0-b1.md" + description: "The path to the changelog from the repo root for this version,\ + \ e.g. .changes/1.8.0-b1.md" value: ${{ jobs.release-inputs.outputs.changelog-path }} secrets: FISHTOWN_BOT_PAT: @@ -165,8 +168,8 @@ jobs: runs-on: ubuntu-latest needs: release-inputs if: | - needs.release-inputs.outputs.changelog-exists == 'false' || - needs.release-inputs.outputs.version-is-current == 'false' + needs.release-inputs.outputs.changelog-exists == 'false' || + needs.release-inputs.outputs.version-is-current == 'false' outputs: name: ${{ steps.release-branch.outputs.name }} @@ -218,7 +221,8 @@ jobs: - core-team steps: - - name: "Checkout ${{ github.event.repository.name }}@${{ needs.release-branch.outputs.name }}" + - name: "Checkout ${{ github.event.repository.name }}@${{ needs.release-branch.outputs.name\ + \ }}" uses: actions/checkout@v4 with: ref: ${{ needs.release-branch.outputs.name }} @@ -243,7 +247,7 @@ jobs: changie batch ${{ needs.release-inputs.outputs.base-version }} \ --include '${{ needs.release-inputs.outputs.base-version }}' \ --remove-prereleases - else # releasing a final patch with no pre-releases + else # releasing a final patch with no pre-releases changie batch ${{ needs.release-inputs.outputs.base-version }} fi changie merge @@ -291,7 +295,8 @@ jobs: - generate-changelog steps: - - name: "Checkout ${{ github.event.repository.name }}@${{ needs.release-branch.outputs.name }}" + - name: "Checkout ${{ github.event.repository.name }}@${{ needs.release-branch.outputs.name\ + \ }}" uses: actions/checkout@v4 with: ref: ${{ needs.release-branch.outputs.name }} @@ -333,7 +338,8 @@ jobs: - bump-version steps: - - name: "Checkout ${{ github.event.repository.name }}@${{ needs.release-branch.outputs.name }}" + - name: "Checkout ${{ github.event.repository.name }}@${{ needs.release-branch.outputs.name\ + \ }}" uses: actions/checkout@v4 with: ref: ${{ needs.release-branch.outputs.name }} @@ -369,7 +375,8 @@ jobs: - 5432:5432 steps: - - name: "Checkout ${{ github.event.repository.name }}@${{ needs.release-branch.outputs.name }}" + - name: "Checkout ${{ github.event.repository.name }}@${{ needs.release-branch.outputs.name\ + \ }}" uses: actions/checkout@v4 with: ref: ${{ needs.release-branch.outputs.name }} @@ -404,9 +411,9 @@ jobs: - release-branch - release-inputs if: | - !failure() && !cancelled() && - needs.release-branch.result == 'success' && - inputs.deploy-to == 'prod' + !failure() && !cancelled() && + needs.release-branch.result == 'success' && + inputs.deploy-to == 'prod' steps: - name: "Checkout ${{ github.event.repository.name }}" @@ -418,7 +425,8 @@ jobs: source_ref: ${{ needs.release-branch.outputs.name }} target_branch: ${{ inputs.branch }} github_token: ${{ secrets.FISHTOWN_BOT_PAT }} - commit_message_template: "[Automated] Merged {source_ref} into target {target_branch} during release process" + commit_message_template: "[Automated] Merged {source_ref} into target {target_branch}\ + \ during release process" - name: "[INFO] Merge changes into ${{ inputs.branch }}" run: | @@ -454,7 +462,8 @@ jobs: fi echo "name=$branch" >> $GITHUB_OUTPUT - - name: "Checkout ${{ github.event.repository.name }}@${{ steps.branch.outputs.name }}" + - name: "Checkout ${{ github.event.repository.name }}@${{ steps.branch.outputs.name\ + \ }}" uses: actions/checkout@v4 with: ref: ${{ steps.branch.outputs.name }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 75a14dd4..de6122ee 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -17,6 +17,7 @@ # Once a day name: "Close stale issues and PRs" + on: schedule: - cron: "30 1 * * *" diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index afb88136..449be023 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -12,7 +12,8 @@ permissions: read-all # will cancel previous workflows triggered by the same event and for the same ref for PRs or same SHA otherwise concurrency: - group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }} + group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, + 'pull_request') && github.event.pull_request.head.ref || github.sha }} cancel-in-progress: true jobs: @@ -23,7 +24,12 @@ jobs: strategy: fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: + - "3.8" + - "3.9" + - "3.10" + - "3.11" + - "3.12" steps: - name: Check out repository diff --git a/.github/workflows/version-bump.yml b/.github/workflows/version-bump.yml index bde34d68..a74d8971 100644 --- a/.github/workflows/version-bump.yml +++ b/.github/workflows/version-bump.yml @@ -17,8 +17,8 @@ on: workflow_dispatch: inputs: version_number: - description: 'The version number to bump to (ex. 1.2.0, 1.3.0b1)' - required: true + description: 'The version number to bump to (ex. 1.2.0, 1.3.0b1)' + required: true jobs: version_bump_and_changie: diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 0bd01f7c..6f612505 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,55 +2,62 @@ default_language_version: python: python3 repos: -- repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.4.0 - hooks: - - id: check-yaml - args: [--unsafe] - - id: check-json - - id: end-of-file-fixer - - id: trailing-whitespace - - id: check-case-conflict + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v4.4.0 + hooks: + - id: check-yaml + - id: check-json + - id: end-of-file-fixer + - id: trailing-whitespace + - id: check-case-conflict + + - repo: https://github.com/lyz-code/yamlfix/ + rev: 1.16.1 + hooks: + - id: yamlfix + args: + - --config-file=yamlfix.toml + files: ^.github/workflows|.pre-commit-config.yaml -- repo: https://github.com/dbt-labs/pre-commit-hooks + - repo: https://github.com/dbt-labs/pre-commit-hooks rev: v0.1.0a1 hooks: - - id: dbt-core-in-adapters-check + - id: dbt-core-in-adapters-check -- repo: https://github.com/psf/black + - repo: https://github.com/psf/black rev: 24.4.0 hooks: - - id: black + - id: black args: - - --line-length=99 - - --target-version=py38 - - --target-version=py39 - - --target-version=py310 - - --target-version=py311 - - --target-version=py312 + - --line-length=99 + - --target-version=py38 + - --target-version=py39 + - --target-version=py310 + - --target-version=py311 + - --target-version=py312 -- repo: https://github.com/pycqa/flake8 + - repo: https://github.com/pycqa/flake8 rev: 7.0.0 hooks: - - id: flake8 + - id: flake8 exclude: tests/ args: - - --max-line-length=99 - - --select=E,F,W - - --ignore=E203,E501,E741,W503,W504 - - --per-file-ignores=*/__init__.py:F401 + - --max-line-length=99 + - --select=E,F,W + - --ignore=E203,E501,E741,W503,W504 + - --per-file-ignores=*/__init__.py:F401 -- repo: https://github.com/pre-commit/mirrors-mypy + - repo: https://github.com/pre-commit/mirrors-mypy rev: v1.9.0 hooks: - - id: mypy + - id: mypy args: - - --explicit-package-bases - - --ignore-missing-imports - - --pretty - - --show-error-codes + - --explicit-package-bases + - --ignore-missing-imports + - --pretty + - --show-error-codes files: ^dbt/adapters/postgres additional_dependencies: - - types-PyYAML - - types-protobuf - - types-pytz + - types-PyYAML + - types-protobuf + - types-pytz diff --git a/yamlfix.toml b/yamlfix.toml new file mode 100644 index 00000000..dac5f8f7 --- /dev/null +++ b/yamlfix.toml @@ -0,0 +1,5 @@ +explicit_start=false +whitelines=1 +section_whitelines=1 +preserve_quotes=true +sequence_style='block_style'