Process changed files #6
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: | ||
types: [opened, edited, reopened] | ||
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 | ||
# 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 | ||
- name: Get changed files | ||
id: changed-files | ||
uses: tj-actions/changed-files@v39 | ||
with: | ||
since_last_remote_commit: "true" | ||
files: | | ||
databases/*.json | ||
files_ignore: databases/database_schema.json | ||
- name: Create matrix from changed files | ||
id: create-matrix | ||
run: | | ||
echo "::set-output name=matrix::$(echo "${{ steps.changed-files.outputs.all_files }}" | tr '\n' ',')" | ||
shell: bash | ||
- name: Get changed files with git diff and send to fts3-connector | ||
id: git-diff | ||
run: | | ||
declare -a CHANGED=($(git diff --name-only -r origin/${{ github.base_ref || github.event.inputs.base }} origin/${{ github.head_ref || github.event.inputs.head }} | grep databases/**)) | ||
for file in "${CHANGED[@]}"; do | ||
echo "Calling with $file" | ||
curl -H "X-AUTH-HEADER: ${{ secrets.FTS3_CLIENT_API_KEY }}" -H "Content-Type: application/json" -X POST -d @$file "${{ vars.FTS3_CLIENT_ENDPOINT }}/transfer/dry" | ||
done | ||
validate_changed_jsons: | ||
needs: changed-files | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
FILENAME: ${{ steps.create-matrix.outputs.matrix }} | ||
Check failure on line 68 in .github/workflows/call_fts3.yml GitHub Actions / Process changed filesInvalid workflow file
|
||
uses: ./.github/workflows/validate_database_json.yml | ||
with: | ||
FILENAME: ${{ matrix.FILENAME }} | ||
secrets: inherit |