chore: add poe get-modified-connectors task (#59130)
This commit is contained in:
committed by
GitHub
parent
17f2d5a09a
commit
422a73ad7d
5
poe-tasks/README.md
Normal file
5
poe-tasks/README.md
Normal file
@@ -0,0 +1,5 @@
|
||||
# Poe Tasks Directory
|
||||
|
||||
This directory stores scripts and task definitions that are intended to be executed from the PoeThePoet task manager.
|
||||
|
||||
You may be able to run them directly, although it is probably easier to run via `poe`.
|
||||
41
poe-tasks/get-modified-connectors.sh
Executable file
41
poe-tasks/get-modified-connectors.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This script is used to find all modified connector directories in the Airbyte repository.
|
||||
# It compares the current branch with the default branch and filters out files that match certain ignore patterns.
|
||||
|
||||
DEFAULT_BRANCH="master"
|
||||
|
||||
# 1) update remote default branch quietly
|
||||
git fetch --quiet origin $DEFAULT_BRANCH
|
||||
|
||||
# 2) set up ignore patterns
|
||||
ignore_patterns=(
|
||||
'README.md'
|
||||
'.coveragerc'
|
||||
)
|
||||
# join with | into a grouped regex
|
||||
ignore_globs="($(IFS='|'; echo "${ignore_patterns[*]}"))$"
|
||||
# 3) collect all file changes
|
||||
committed=$(git diff --name-only origin/$DEFAULT_BRANCH...HEAD)
|
||||
staged=$(git diff --cached --name-only)
|
||||
unstaged=$(git diff --name-only)
|
||||
untracked=$(git ls-files --others --exclude-standard)
|
||||
|
||||
# 4) merge into one list
|
||||
all_changes=$(printf '%s\n%s\n%s\n%s' "$committed" "$staged" "$unstaged" "$untracked")
|
||||
|
||||
# 5) drop ignored files
|
||||
filtered=$(printf '%s\n' "$all_changes" | grep -v -E "/${ignore_globs}")
|
||||
|
||||
# 6) keep only connector paths
|
||||
connectors=$(printf '%s\n' "$filtered" | grep -E '^airbyte-integrations/connectors/[^/]+' )
|
||||
|
||||
# 7) extract just the connector directory name
|
||||
dirs=$(printf '%s\n' "$connectors" \
|
||||
| sed -E 's|airbyte-integrations/connectors/([^/]+).*|\1|'
|
||||
)
|
||||
|
||||
# 8) output sorted, unique list
|
||||
if [ "$dirs" ]; then
|
||||
printf '%s\n' "$dirs" | sort -u
|
||||
fi
|
||||
@@ -22,6 +22,11 @@ pnpm install
|
||||
pnpm build
|
||||
'''
|
||||
|
||||
[tasks.get-modified-connectors]
|
||||
help = """List Airbyte connectors modified. This considers all committed, staged, unstaged, and untracked files.
|
||||
"""
|
||||
shell = "./poe-tasks/get-modified-connectors.sh"
|
||||
|
||||
[tasks.connector]
|
||||
help = "Run a poe task in a connector's directory. Usage: poe connector <connector-name> <task> [args...]"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user