From fb93ca1fea20291cae7ac485d2dcb29232339f1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Burwash?= <35510512+SBurwash@users.noreply.github.com> Date: Thu, 7 Mar 2024 13:54:44 -0500 Subject: [PATCH] DE-2913 Maintenance - Implemente dependabot as package manager - Implement Automatic PR merging & dependency management in Wrike-Sdk (#26) * Removed renovate * Added dependabot * Add lock file --- .github/dependabot.yml | 56 ++++++++++++++++++ .../workflows/ci_validate_meltano_install.yml | 21 +++++++ .github/workflows/dependabot_auto_merge.yml | 57 +++++++++++++++++++ plugins/loaders/target-jsonl--andyh1203.lock | 34 +++++++++++ renovate.json | 6 -- 5 files changed, 168 insertions(+), 6 deletions(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/ci_validate_meltano_install.yml create mode 100644 .github/workflows/dependabot_auto_merge.yml create mode 100644 plugins/loaders/target-jsonl--andyh1203.lock delete mode 100644 renovate.json diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..02f7042 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,56 @@ +version: 2 + +updates: + - package-ecosystem: pip + open-pull-requests-limit: 5 + directory: / + registries: "*" + schedule: + interval: daily + time: "10:00" + timezone: America/Montreal + reviewers: + - potloc/data-engineering + assignees: + - potloc/data-engineering + labels: + - python + - dependencies + groups: # https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file#groups + minor-updates: + update-types: + - minor + patterns: + - "*" + major-updates: + update-types: + - major + patterns: + - "*" + rebase-strategy: auto + + - package-ecosystem: github-actions + open-pull-requests-limit: 5 + directory: / + schedule: + interval: daily + time: "10:00" + timezone: America/Montreal + reviewers: + - potloc/data-engineering + assignees: + - potloc/data-engineering + labels: + - github-actions + - dependencies + groups: + minor-updates: + update-types: + - minor + patterns: + - "*" + major-updates: + update-types: + - major + patterns: + - "*" \ No newline at end of file diff --git a/.github/workflows/ci_validate_meltano_install.yml b/.github/workflows/ci_validate_meltano_install.yml new file mode 100644 index 0000000..5676606 --- /dev/null +++ b/.github/workflows/ci_validate_meltano_install.yml @@ -0,0 +1,21 @@ +name: Validate Meltano Install +on: + pull_request: + types: + - opened + - reopened + - synchronize + +jobs: + setup-meltano: + name: Validate meltano configurations + runs-on: ubuntu-latest + timeout-minutes: 20 + + steps: + - uses: actions/checkout@v4 + - run: pip install meltano boto3 + - name: Install dependencies + run: meltano install --clean + - name: Validate meltano install + run: meltano schedule list diff --git a/.github/workflows/dependabot_auto_merge.yml b/.github/workflows/dependabot_auto_merge.yml new file mode 100644 index 0000000..4c6a82f --- /dev/null +++ b/.github/workflows/dependabot_auto_merge.yml @@ -0,0 +1,57 @@ +name: Dependabot +on: + pull_request: + types: + - opened + - reopened + - synchronize + +permissions: + contents: write + pull-requests: write + repository-projects: read + +jobs: + dependabot: + name: Enable Auto-Merge and Approve + if: ${{ github.actor == 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'automerge') && !contains(github.head_ref, '/terraform/') }} + runs-on: ubuntu-latest + steps: + - name: Fetch Dependabot Metadata + id: metadata + uses: dependabot/fetch-metadata@v1 + with: + github-token: "${{ secrets.GITHUB_TOKEN }}" + + - name: GitHub Actions - Patch or Minor + if: ${{ contains(github.head_ref, '/github_actions/') && (steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch') }} + shell: bash --noprofile --norc -xeo pipefail {0} + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr review "$PR_URL" --approve + gh pr merge "$PR_URL" --auto --squash + gh pr edit "$PR_URL" --add-label 'automerge' + + - name: Development - Patch or Minor + if: ${{ !contains(github.head_ref, '/github_actions/') && (steps.metadata.outputs.update-type == 'version-update:semver-minor' || steps.metadata.outputs.update-type == 'version-update:semver-patch') && steps.metadata.outputs.dependency-type == 'direct:development' }} + shell: bash --noprofile --norc -xeo pipefail {0} + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr review "$PR_URL" --approve + gh pr merge "$PR_URL" --auto --squash + gh pr edit "$PR_URL" --add-label 'automerge' + + - name: Production - Patch + if: ${{ !contains(github.head_ref, '/github_actions/') && steps.metadata.outputs.update-type == 'version-update:semver-patch' && steps.metadata.outputs.dependency-type == 'direct:production' }} + shell: bash --noprofile --norc -xeo pipefail {0} + env: + PR_URL: ${{ github.event.pull_request.html_url }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + gh pr review "$PR_URL" --approve + gh pr merge "$PR_URL" --auto --squash + gh pr edit "$PR_URL" --add-label 'automerge' \ No newline at end of file diff --git a/plugins/loaders/target-jsonl--andyh1203.lock b/plugins/loaders/target-jsonl--andyh1203.lock new file mode 100644 index 0000000..5825fc4 --- /dev/null +++ b/plugins/loaders/target-jsonl--andyh1203.lock @@ -0,0 +1,34 @@ +{ + "plugin_type": "loaders", + "name": "target-jsonl", + "namespace": "target_jsonl", + "variant": "andyh1203", + "label": "JSON Lines (JSONL)", + "docs": "https://hub.meltano.com/loaders/target-jsonl--andyh1203", + "repo": "https://github.com/andyh1203/target-jsonl", + "pip_url": "target-jsonl", + "description": "JSONL loader", + "logo_url": "https://hub.meltano.com/assets/logos/loaders/jsonl.png", + "settings": [ + { + "name": "destination_path", + "kind": "string", + "value": "output", + "label": "Destination Path", + "description": "Sets the destination path the JSONL files are written to, relative\nto the project root.\n\nThe directory needs to exist already, it will not be created\nautomatically.\n\nTo write JSONL files to the project root, set an empty string (`\"\"`).\n" + }, + { + "name": "do_timestamp_file", + "kind": "boolean", + "value": false, + "label": "Include Timestamp in File Names", + "description": "Specifies if the files should get timestamped.\n\nBy default, the resulting file will not have a timestamp in the file name (i.e. `exchange_rate.jsonl`).\n\nIf this option gets set to `true`, the resulting file will have a timestamp associated with it (i.e. `exchange_rate-{timestamp}.jsonl`).\n" + }, + { + "name": "custom_name", + "kind": "string", + "label": "Custom File Name Override", + "description": "Specifies a custom name for the filename, instead of the stream name.\n\nThe file name will be `{custom_name}-{timestamp}.jsonl`, if `do_timestamp_file` is `true`.\nOtherwise the file name will be `{custom_name}.jsonl`.\n\nIf custom name is not provided, the stream name will be used.\n" + } + ] +} \ No newline at end of file diff --git a/renovate.json b/renovate.json deleted file mode 100644 index 39a2b6e..0000000 --- a/renovate.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "config:base" - ] -}