Skip to content

Gated Auto-Merger

Gated Auto-Merger #17

name: Gated Auto-Merger
on:
workflow_dispatch:
inputs:
component:
type: choice
description: select component
options:
- Dashboard
env:
METADATA: "data/metadata.yaml"
jobs:
gated-auto-merger:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
path: main
- name: Set up Python environment
uses: actions/setup-python@v4
with:
python-version: '3.10.15' # Specify the Python version you need
- name: Install pipenv
run: |
python -m pip install --upgrade pip
pip install pipenv
- name: Install dependencies from Pipfile.lock
run: cd main && pipenv install --ignore-pipfile
- name: Trigger GAM
env:
HYDRA_TOKEN: ${{ secrets.HYDRA_TOKEN }}
shell: bash
id: trigger_gam
run: |
cd main
pipenv run python src/main.py --component ${{ github.event.inputs.component }}
- uses: actions/checkout@v3
with:
ref: metadata
path: metadata
- name: Copy metadata Json
id: copy_meta
run: |
meta=$(yq -o json main/$METADATA)
execution_id=$(echo $meta | jq -r '.metadata.execution_id')
component_name=$(echo $meta | jq -r '.metadata.name')
metadata_folder="metadata/executions/${component_name}/${execution_id}"
mkdir -p ${metadata_folder}
cp main/$METADATA ${metadata_folder}
echo "Metadata File: ${metadata_folder}"
echo "Copied Metadata:"
cat ${metadata_folder}/metadata.yaml
echo "EXECUTION_ID=${execution_id}" >> $GITHUB_OUTPUT
- name: Commit and push changes to main branch
uses: actions-js/push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
directory: metadata
branch: metadata
message: "Adding metadata.yaml for execution-id ${{ steps.copy_meta.outputs.EXECUTION_ID }}"
repository: red-hat-data-services/Gated-Auto-Merger