Skip to content

flxbl-io/analyze-issue

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Analyze Issue

CI Version

A GitHub Action that analyzes issues for sfops IssueOps operations. Parses issue body and labels to extract operation type, parameters, and metadata for workflow automation.

Description

This action is designed for the IssueOps pattern used by sfops. It:

  • Parses JSON payloads embedded in issue body comments (<!-- {...} -->)
  • Extracts operation types from labels (e.g., sfops-deploy, issueops-provision)
  • Provides filtering via include/exclude issue ID lists
  • Outputs structured data for downstream workflow steps

Usage

- name: Analyze Issue
  uses: flxbl-io/analyze-issue@v1
  id: analyze
  with:
    gh-token: ${{ secrets.GITHUB_TOKEN }}
    issue-number: ${{ github.event.issue.number }}

- name: Process if sfops issue
  if: steps.analyze.outputs.is-sfops-issue == 'true'
  run: |
    echo "Operation: ${{ steps.analyze.outputs.operation-type }}"
    echo "Environments: ${{ steps.analyze.outputs.envs }}"
    echo "Payload: ${{ steps.analyze.outputs.payload }}"

Issue Format

The action expects issues to contain a JSON payload in an HTML comment:

## Deploy Request

Please deploy the following changes to production.

<!-- {"id": "deploy-prod", "envs": ["prod"], "packages": ["core", "ui"]} -->

Payload Structure

Field Type Description
id string Unique identifier for the operation
envs string[] Target environments (defaults to ["devhub"])
operation / operationType / type string Operation type (alternative to label-based detection)
* any Any additional fields are passed through in the payload

Inputs

Input Required Default Description
gh-token Yes - GitHub token for authentication
issue-number Yes - Issue number to analyze
repository No ${{ github.repository }} Repository in owner/repo format
include-issues No '' Comma-separated list of issue IDs to include
exclude-issues No '' Comma-separated list of issue IDs to exclude

Outputs

Output Description
is-sfops-issue true if issue contains valid sfops payload
payload JSON string of the complete enriched payload
issue-number The analyzed issue number
issue-creator GitHub username of the issue creator
issue-id The id field from the payload
envs JSON array of target environments
operation-type Detected operation type
labels JSON array of issue label names
sfops-issue-* Dynamic outputs for each payload field

Examples

Basic Usage

name: Process IssueOps

on:
  issues:
    types: [opened, edited]

jobs:
  analyze:
    runs-on: ubuntu-latest
    steps:
      - name: Analyze Issue
        uses: flxbl-io/analyze-issue@v1
        id: analyze
        with:
          gh-token: ${{ secrets.GITHUB_TOKEN }}
          issue-number: ${{ github.event.issue.number }}

      - name: Deploy
        if: steps.analyze.outputs.is-sfops-issue == 'true' && steps.analyze.outputs.operation-type == 'deploy'
        run: |
          echo "Deploying to: ${{ steps.analyze.outputs.envs }}"

With Include/Exclude Filtering

- name: Analyze Issue
  uses: flxbl-io/analyze-issue@v1
  with:
    gh-token: ${{ secrets.GITHUB_TOKEN }}
    issue-number: ${{ github.event.issue.number }}
    include-issues: 'deploy-prod,deploy-uat'
    exclude-issues: 'deploy-dev'

Using Dynamic Outputs

- name: Analyze Issue
  uses: flxbl-io/analyze-issue@v1
  id: analyze
  with:
    gh-token: ${{ secrets.GITHUB_TOKEN }}
    issue-number: ${{ github.event.issue.number }}

- name: Access Custom Fields
  if: steps.analyze.outputs.is-sfops-issue == 'true'
  run: |
    # Access standard outputs
    echo "Creator: ${{ steps.analyze.outputs.issue-creator }}"

    # Access dynamic outputs (for payload field "customField")
    echo "Custom: ${{ steps.analyze.outputs.sfops-issue-customField }}"

Operation Type Detection

The action detects operation types in the following order:

  1. operation, operationType, or type field in payload
  2. Labels with sfops- prefix (e.g., sfops-deploy -> deploy)
  3. Labels with issueops- prefix (e.g., issueops-provision -> provision)
  4. Common operation labels: deploy, release, provision, create, delete, update, refresh

Development

Prerequisites

  • Node.js >= 20
  • npm

Setup

npm install

Build

npm run build

Test

npm test
npm run test:coverage

Lint

npm run lint
npm run format

License

Copyright 2025 flxbl-io. All rights reserved.

See LICENSE for details.

About

GitHub Action: analyze-issue

Resources

License

Stars

Watchers

Forks

Packages