Dweinholz patch 1 #41
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
# Forked from eKatchko/public-bioinformatics-databases | |
name: Process changed files | |
# Controls when the workflow will run | |
on: | |
pull_request: | |
branches: | |
- 'main' | |
paths: | |
- 'databases/**.json' | |
workflow_dispatch: | |
inputs: | |
base: | |
type: string | |
default: main | |
required: true | |
head: | |
type: string | |
required: true | |
jobs: | |
# This workflow contains a single job called "changed-files" | |
changed-files: | |
# The type of runner that the job will run on | |
runs-on: [self-hosted, fts3-client-production ] | |
environment: APPROVAL_REQUIRED | |
outputs: | |
changed_files: ${{ steps.create-matrix.outputs.matrix }} | |
# Steps represent a sequence of tasks that will be executed as part of the job | |
steps: | |
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
path: fts3-databases | |
- name: Get changed files with git diff | |
id: git-diff | |
run: | | |
git_diff_output=$(git diff --name-only origin/${{ github.base_ref || github.event.inputs.base }} origin/${{ github.head_ref || github.event.inputs.head }} | grep databases/) | |
echo "files=$git_diff_output" >> "$GITHUB_OUTPUT" | |
- name: Send changed files to fts3-connector | |
if: steps.git-diff.outputs.files != '' | |
run: | | |
git_diff_output="${{ steps.git-diff.outputs.files}}" | |
for file in $git_diff_output; do | |
echo "Calling with $file" | |
curl -H "X-AUTH-HEADER: ${{ secrets.FTS3_CLIENT_API_KEY }}" -H "Content-Type: application/json" -X POST -d @"$file" "${{ secrets.FTS3_CLIENT_ENDPOINT }}/transfer/dry" | |
done | |
- name: Skip if no changed files | |
if: steps.git-diff.outputs.files == '' | |
run: | | |
echo "No changed files found in the 'databases/' directory. Skipping the step." | |