# Copyright (C) 2024 Intel Corporation
# SPDX-License-Identifier: Apache-2.0

name: Freeze-requirements

on:
  workflow_dispatch:

jobs:
  freeze-requirements:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v4
        with:
          fetch-depth: 0
          ref: ${{ github.ref }}

      - uses: actions/setup-python@v5
        with:
          python-version: "3.10"

      - name: Set up Git
        run: |
          git config --global user.name "CICD-at-OPEA"
          git config --global user.email "CICD@opea.dev"
          git remote set-url origin https://CICD-at-OPEA:"${{ secrets.ACTION_TOKEN }}"@github.com/opea-project/GenAIComps.git

      - name: Run script
        run: |
          bash .github/workflows/scripts/freeze_requirements.sh

      - name: Commit changes
        run: |
          git add .
          git commit -s -m "Freeze requirements"
          git push
