Skip to content

chore: [Hub Bot] Refresh metadata 2024-11-25 #1368

chore: [Hub Bot] Refresh metadata 2024-11-25

chore: [Hub Bot] Refresh metadata 2024-11-25 #1368

Workflow file for this run

name: Plugin 'Test' Command Dispatcher
on:
pull_request_target:
types:
- opened
- synchronize
- reopened
paths:
- "_data/meltano/*/*/*.yml"
jobs:
get_changed_files:
name: Get changed files
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout the repository
uses: actions/[email protected]
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.sha }}
repository: ${{ github.event.pull_request.head.repo.full_name }}
- name: Get changed files
id: changed_files
uses: tj-actions/[email protected]
with:
sha: ${{ github.event.pull_request.head.sha }}
json: "true"
- name: Filter changed files
id: filter_files
run: echo "filtered_files=$(echo ${{ steps.changed_files.outputs.all_changed_files }} | jq -c 'map(select(startswith("_data/meltano/") and (endswith(".yml") and (endswith("airbyte.yml") | not))))' | sed 's/"/\\"/g')" >> "$GITHUB_OUTPUT"
- id: set-matrix
run: echo "matrix={\"changed_file\":${{ steps.filter_files.outputs.filtered_files }}}" >> "$GITHUB_OUTPUT"
dispatch_tests:
name: Dispatch tests
runs-on: ubuntu-latest
needs:
- get_changed_files
strategy:
matrix: ${{ fromJson(needs.get_changed_files.outputs.matrix) }}
max-parallel: 4
fail-fast: false
steps:
- name: Checkout the repository
uses: actions/[email protected]
with:
ref: ${{ github.event.pull_request.head.sha }}
- name: Install yq
env:
VERSION: v4.28.2
BINARY: yq_linux_amd64
run: >
wget https://github.com/mikefarah/yq/releases/download/${VERSION}/${BINARY}.tar.gz -O - |
tar xz && mv ${BINARY} yq && chmod u+x yq
- name: Get the name and pip url
run: |
name="$(basename "$(dirname "${{ matrix.changed_file }}")")"
pip_url="$(./yq '.pip_url // ""' "${{ matrix.changed_file }}")"
variant="$(./yq '.variant' "${{ matrix.changed_file }}")"
echo "name=${name}" >> $GITHUB_ENV
echo "pip_url=${pip_url}" >> $GITHUB_ENV
echo "prelude=Testing plugin \`${name}\` (\`${variant}\` variant):" >> $GITHUB_ENV
- name: Find the MeltyBot test-command comment if it exists
if: ${{ env.pip_url != '' }}
id: find_comment
uses: peter-evans/find-comment@v3
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: ${{ env.prelude }}
- uses: octokit/[email protected]
if: ${{ env.pip_url != '' }}
with:
route: "POST /repos/${{ github.repository }}/actions/workflows/test-plugin-command.yml/dispatches"
ref: 'main'
inputs: "{\"repository\":\"${{ github.repository }}\",\"comment-id\":\"${{ steps.find_comment.outputs.comment-id }}\",\"issue-number\":\"${{ github.event.pull_request.number }}\",\"name\":\"${{ env.name }}\",\"pip-url\":\"${{ env.pip_url }}\",\"prepend-text\":\"${{ env.prelude }}\"}"
env:
GITHUB_TOKEN: ${{ secrets.MELTYBOT_GITHUB_AUTH_TOKEN }}