GitScrum / Docs

CI/CD Integration

Integrate GitScrum CLI with GitHub Actions, GitLab CI, and Bitbucket Pipelines. Automate task status, time tracking, and sprint reports.

Open Source — GitScrum CLI is open source under the MIT license. Available on GitHub and all major package managers. Built for developers — Tasks, timers, sprints, and analytics in your terminal. Git-aware. CI/CD ready.

The GitScrum CLI is built for automation. Use it in your pipelines to sync task status, track deployment time, generate reports, and more.


Authentication

In headless environments, authenticate using an environment variable:

export GITSCRUM_ACCESS_TOKEN="your-oauth-access-token"

Obtaining a Token

  1. Run gitscrum auth login locally
  2. Copy access_token from ~/.gitscrum/token.json
  3. Add it as a secret in your CI/CD platform

GitHub Actions

Setup

Add the token as a repository secret: Settings > Secrets > GITSCRUMACCESSTOKEN

Update Task Status on PR Merge

name: Update GitScrum Task
on:
  pull_request:
    types: [closed]

jobs:
  update-task:
    if: github.event.pull_request.merged == true
    runs-on: ubuntu-latest
    steps:
      - name: Install GitScrum CLI
        run: curl -sL https://raw.githubusercontent.com/gitscrum-core/cli/main/install.sh | sh

      - name: Update task to Done
        env:
          GITSCRUM_ACCESS_TOKEN: ${{ secrets.GITSCRUM_ACCESS_TOKEN }}
        run: |
          TASK=$(echo "${{ github.head_ref }}" | grep -oE '[A-Z]+-[0-9]+' | head -1)
          if [ -n "$TASK" ]; then
            gitscrum tasks update $TASK --status done
            echo "Updated $TASK to Done"
          fi

Sync PR Status with Task

name: Sync PR Status
on:
  pull_request:
    types: [opened, closed, reopened]

jobs:
  sync:
    runs-on: ubuntu-latest
    steps:
      - name: Install GitScrum CLI
        run: curl -sL https://raw.githubusercontent.com/gitscrum-core/cli/main/install.sh | sh

      - name: Sync status
        env:
          GITSCRUM_ACCESS_TOKEN: ${{ secrets.GITSCRUM_ACCESS_TOKEN }}
        run: |
          TASK=$(echo "${{ github.head_ref }}" | grep -oE '[A-Z]+-[0-9]+' | head -1)
          if [ -z "$TASK" ]; then exit 0; fi

          case "${{ github.event.action }}" in
            opened)
              gitscrum tasks update $TASK --status "in review"
              ;;
            closed)
              if [ "${{ github.event.pull_request.merged }}" == "true" ]; then
                gitscrum tasks update $TASK --status done
              fi
              ;;
          esac

Track Deployment Time

name: Deploy and Track
on:
  push:
    branches: [main]

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4

      - name: Install GitScrum CLI
        run: curl -sL https://raw.githubusercontent.com/gitscrum-core/cli/main/install.sh | sh

      - name: Start timer
        env:
          GITSCRUM_ACCESS_TOKEN: ${{ secrets.GITSCRUM_ACCESS_TOKEN }}
        run: |
          echo "DEPLOY_START=$(date +%s)" >> $GITHUB_ENV

      - name: Deploy
        run: |
          # Your deployment steps here
          echo "Deploying..."

      - name: Log deployment time
        env:
          GITSCRUM_ACCESS_TOKEN: ${{ secrets.GITSCRUM_ACCESS_TOKEN }}
        run: |
          TASK=$(git log -1 --pretty=%B | grep -oE '[A-Z]+-[0-9]+' | head -1)
          if [ -n "$TASK" ]; then
            DURATION=$(( $(date +%s) - $DEPLOY_START ))
            MINUTES=$(( DURATION / 60 ))
            if [ $MINUTES -gt 0 ]; then
              gitscrum timer log $TASK "${MINUTES}m" -d "Deployment to production"
            fi
          fi

Weekly Sprint Report

name: Sprint Report
on:
  schedule:
    - cron: '0 9 * * 1'  # Every Monday at 9 AM

jobs:
  report:
    runs-on: ubuntu-latest
    steps:
      - name: Install GitScrum CLI
        run: curl -sL https://raw.githubusercontent.com/gitscrum-core/cli/main/install.sh | sh

      - name: Generate report
        env:
          GITSCRUM_ACCESS_TOKEN: ${{ secrets.GITSCRUM_ACCESS_TOKEN }}
        run: |
          gitscrum sprints current --json > sprint-report.json

      - name: Send to Slack
        # Add your Slack notification step
        run: |
          # curl -X POST ... 

GitLab CI

Variables

Add GITSCRUMACCESSTOKEN in Settings > CI/CD > Variables.

Update Task on Merge

stages:
  - sync

sync-task:
  stage: sync
  image: alpine
  only:
    - merge_requests
  script:
    - apk add --no-cache curl grep
    - curl -sL https://raw.githubusercontent.com/gitscrum-core/cli/main/install.sh | sh
    - TASK=$(echo "$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME" | grep -oE '[A-Z]+-[0-9]+' | head -1)
    - |
      if [ -n "$TASK" ]; then
        if [ "$CI_MERGE_REQUEST_STATE" = "merged" ]; then
          gitscrum tasks update $TASK --status done
        else
          gitscrum tasks update $TASK --status "in review"
        fi
      fi

Pipeline Status Sync

pipeline-status:
  stage: notify
  script:
    - TASK=$(echo "$CI_COMMIT_REF_NAME" | grep -oE '[A-Z]+-[0-9]+' | head -1)
    - |
      if [ -n "$TASK" ]; then
        if [ "$CI_JOB_STATUS" = "success" ]; then
          gitscrum tasks update $TASK --status "deployed"
        else
          gitscrum tasks update $TASK --status "blocked"
        fi
      fi

Bitbucket Pipelines

Repository Variables

Add GITSCRUMACCESSTOKEN in Repository settings > Pipelines > Variables.

PR Status Sync

pipelines:
  pull-requests:
    '**':
      - step:
          name: Sync GitScrum
          script:
            - curl -sL https://raw.githubusercontent.com/gitscrum-core/cli/main/install.sh | sh
            - TASK=$(echo "$BITBUCKET_BRANCH" | grep -oE '[A-Z]+-[0-9]+' | head -1)
            - |
              if [ -n "$TASK" ]; then
                gitscrum tasks update $TASK --status "in review"
              fi

  branches:
    main:
      - step:
          name: Deploy and sync
          script:
            - curl -sL https://raw.githubusercontent.com/gitscrum-core/cli/main/install.sh | sh
            - # Deploy steps...
            - TASK=$(git log -1 --pretty=%B | grep -oE '[A-Z]+-[0-9]+' | head -1)
            - |
              if [ -n "$TASK" ]; then
                gitscrum tasks update $TASK --status done
              fi

Common Patterns

Extract Task Code from Branch

TASK=$(echo "$BRANCH_NAME" | grep -oE '[A-Z]+-[0-9]+' | head -1)

Extract from Commit Message

TASK=$(git log -1 --pretty=%B | grep -oE '[A-Z]+-[0-9]+' | head -1)

Check if Task Exists Before Update

if [ -n "$TASK" ]; then
  if gitscrum tasks view $TASK --json > /dev/null 2>&1; then
    gitscrum tasks update $TASK --status done
  fi
fi

Fail Pipeline if Task Blocked

STATUS=$(gitscrum tasks view $TASK --json | jq -r '.status')
if [ "$STATUS" = "blocked" ]; then
  echo "Task $TASK is blocked. Resolve blockers before continuing."
  exit 1
fi

Environment Variables Reference

VariableDescription
GITSCRUMACCESSTOKENOAuth access token (required)
GITSCRUM_WORKSPACEOverride default workspace
GITSCRUM_PROJECTOverride default project
GITSCRUMAPIURLCustom API URL (enterprise)