Kadanza DAM media connector v0.0.1 #131
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Validate Connector PR | |
on: | |
pull_request: | |
paths: | |
- 'src/connectors/**' | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Get changed files | |
id: files | |
uses: jitterbit/get-changed-files@v1 | |
- name: Ensure only one connector is changed | |
id: check_connector | |
run: | | |
connector_changed="" | |
for changed_file in ${{ steps.files.outputs.all }} | |
do | |
# Extract the first tree segments of the path (e.g., src/connectors/connector-name) | |
connector_path=$(echo "$changed_file" | cut -d'/' -f1-3) | |
if [[ "$connector_path" == src/connectors/* ]] | |
then | |
# Extract the connector name (e.g., connector-name) | |
connector_name=$(echo "$connector_path" | cut -d'/' -f3) | |
if [[ -z "$connector_changed" ]] | |
then | |
connector_changed="$connector_name" | |
elif [[ "$connector_changed" != "$connector_name" ]] | |
then | |
echo "Multiple connectors have been changed: $connector_changed and $connector_name. Please change only one connector per PR." | |
exit 1 | |
fi | |
fi | |
done | |
echo "::set-output name=connector::$connector_changed" | |
- name: Ensure connector version is bumped | |
run: | | |
connector_changed="" | |
for changed_file in ${{ steps.files.outputs.all }} | |
do | |
# Extract the first tree segments of the path (e.g., src/connectors/connector-name) | |
connector_path=$(echo "$changed_file" | cut -d'/' -f1-3) | |
if [[ "$connector_path" == src/connectors/* ]] | |
then | |
# Extract the connector name (e.g., connector-name) | |
connector_name=$(echo "$connector_path" | cut -d'/' -f3) | |
if [[ -z "$connector_changed" ]] | |
then | |
MAIN_VERSION=$(git show origin/main:src/connectors/$connector_name/package.json | jq -r .version) | |
PR_VERSION=$(jq -r .version src/connectors/$connector_name/package.json) | |
if [ "$MAIN_VERSION" = "$PR_VERSION" ]; then | |
echo "Error: The version in src/connectors/$connector_name/package.json is the same as in the main branch. Please bump the version" | |
exit 1 | |
fi | |
fi | |
fi | |
done | |
- name: Add labels | |
uses: actions-ecosystem/action-add-labels@v1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
labels: | | |
${{ steps.check_connector.outputs.connector }} | |
connector-change |