46 lines
1.3 KiB
YAML
46 lines
1.3 KiB
YAML
name: Checkout Code Template
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
target_branch:
|
|
description: 'Target branch to clone'
|
|
required: true
|
|
type: string
|
|
git_repo_url:
|
|
description: 'Git repository URL to clone from'
|
|
required: true
|
|
type: string
|
|
deployment_env:
|
|
description: 'Deployment environment name'
|
|
required: true
|
|
type: string
|
|
tags_version:
|
|
description: 'Tag version'
|
|
required: true
|
|
type: string
|
|
secrets:
|
|
GITLAB_TOKEN:
|
|
required: true
|
|
|
|
jobs:
|
|
checkout-and-verify:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Show Configuration
|
|
run: |
|
|
echo "Target Branch: ${{ inputs.target_branch }}"
|
|
echo "Deployment Environment: ${{ inputs.deployment_env }}"
|
|
echo "Tags Version: ${{ inputs.tags_version }}"
|
|
|
|
- name: Checkout Code from GitLab
|
|
env:
|
|
GITLAB_TOKEN: ${{ secrets.GITLAB_TOKEN }}
|
|
run: |
|
|
echo "Cloning branch '${{ inputs.target_branch }}'..."
|
|
git clone --branch ${{ inputs.target_branch }} https://oauth2:${GITLAB_TOKEN}@${{ inputs.git_repo_url }} .
|
|
|
|
- name: Verify Code Checkout
|
|
run: |
|
|
echo "Successfully checked out target branch!"
|
|
ls -la |