Skip to main content
The repository provisioning workflow automatically sets up new agent repositories when they are cloned or created from a template.

Overview

When a new repository is created from a template, the workflow:
  1. Detects initial commit
  2. Sets up project configuration
  3. Baselines service version
  4. Provisions Python project structure

Workflow Triggers

The provisioning workflow is triggered on:
  • Initial Push: First push to develop branch
  • Manual Trigger: Via workflow_dispatch
The workflow only runs if:
  • It’s the first workflow run (github.run_number == 1)
  • The pusher name starts with gc-tfrw- (Terraform workflow bot)

Provisioning Process

1. Project Setup

The workflow sets up the project:
  • Authentication: Uses GitHub App for authentication
  • Repository Access: Checks out code with proper permissions
  • Token Generation: Creates GitHub token for subsequent steps

2. Python Project Provisioning

The workflow provisions the Python project:
  • Package Configuration: Sets up package name based on repository name
  • Project Structure: Creates standard Python project structure
  • Version Baseline: Sets initial version in project files

Workflow Flowchart

Workflow Configuration

The repository provisioning workflow is defined in .github/workflows/repository-provisioning.yaml:
name: Provision repository on initial commit
###
# This workflow is intended to run on repo cloning/templating
# Baseline the version in pyproject.toml
###
on:
    push:
        branches:
            - develop
    workflow_dispatch:
jobs:
    provision:
        runs-on: ubuntu-latest
        if: | # Check GitHub workflow run number and repository pusher name
            github.run_number == 1 && startsWith(github.event.pusher.name, 'gc-tfrw-')
        name: Provision project
        timeout-minutes: 10
        steps:
            - name: Setup project
              uses: backbase-common/gc-ai-workflows/setup-project@main
              with:
                  ref: ${{ github.ref }}
                  fetchDepth: "1"
                  githubPrivateKey: ${{ secrets.GIT_GITHUB_APP_PEM_FILE }}
                  githubAppId: ${{ secrets.GIT_GITHUB_APP_ID }}
              id: setup-project
            - name: Provision templates
              uses: backbase-common/gc-ai-workflows/provision-python-project@main
              with:
                  githubToken: ${{ steps.setup-project.outputs.githubToken }}
                  packageName: ${{ github.event.repository.name }}
[!TIP] See the Configurations page for complete setup instructions and required secrets.

Configuration

Required Secrets

The workflow requires these secrets:
  • GIT_GITHUB_APP_PEM_FILE: GitHub App private key
  • GIT_GITHUB_APP_ID: GitHub App ID

Workflow Conditions

The workflow only runs when:
  • github.run_number == 1: First workflow run
  • startsWith(github.event.pusher.name, 'gc-tfrw-'): Pushed by Terraform workflow

Provisioning Steps

Setup Project

The setup-project action:
  • Authenticates using GitHub App
  • Checks out repository code
  • Generates GitHub token for subsequent steps
  • Sets up project environment

Provision Python Project

The provision-python-project action:
  • Creates Python package structure
  • Sets package name from repository name
  • Configures project files
  • Baselines version information

What Gets Provisioned

The workflow provisions:
  • Package Structure: Standard Python package layout
  • Configuration Files: Project configuration files
  • Version Information: Initial version baseline
  • Project Metadata: Repository name and metadata

Best Practices

  • Template Usage: Create repositories from templates for automatic provisioning
  • Secret Configuration: Ensure GitHub App secrets are configured
  • First Commit: Push initial commit to develop branch
  • Verification: Verify provisioning completed successfully

Troubleshooting

Workflow Not Running

If the workflow doesn’t run:
  1. Check Run Number: Ensure it’s the first workflow run
  2. Verify Pusher: Check if pusher name starts with gc-tfrw-
  3. Branch Check: Ensure push is to develop branch
  4. Manual Trigger: Use workflow_dispatch if needed

Provisioning Failures

Common issues:
  1. Authentication: Verify GitHub App credentials
  2. Permissions: Check repository permissions
  3. Secrets: Ensure secrets are properly configured
  4. Timeout: Workflow times out after 10 minutes

Next Steps