返回技能列表

setup-putior-ci

pjt222
更新于 2 days ago
6 次查看
17
2
17
在 GitHub 上查看
automation

关于

This skill sets up a GitHub Actions CI/CD pipeline to automatically regenerate putior workflow diagrams on every push. It creates the necessary workflow YAML, an R script for diagram generation with sentinel markers, and handles auto-committing updated diagrams. Use it when you need diagrams to always reflect current code state or to replace manual regeneration with automation.

快速安装

Claude Code

推荐
主要方式
npx skills add pjt222/agent-almanac -a claude-code
插件命令备选方式
/plugin add https://github.com/pjt222/agent-almanac
Git 克隆备选方式
git clone https://github.com/pjt222/agent-almanac.git ~/.claude/skills/setup-putior-ci

在 Claude Code 中复制并粘贴此命令以安装该技能

技能文档

Putior-CI einrichten

Konfigurieren GitHub Actions to automatisch regenerate workflow diagrams when Quellcode changes, keeping documentation in sync with code.

Wann verwenden

  • Workflow diagrams should always reflect the current state of the code
  • The project has CI/CD and wants automated documentation updates
  • Multiple contributors may change workflow-affecting code
  • Replacing manual diagram regeneration with automated pipeline

Eingaben

  • Erforderlich: GitHub repository with putior annotations in Quelldateis
  • Erforderlich: Target file for diagram output (e.g., README.md, docs/workflow.md)
  • Optional: putior theme (default: "github")
  • Optional: Source directories to scan (default: "./R/" or "./src/")
  • Optional: Branch to trigger on (default: main)

Vorgehensweise

Schritt 1: Erstellen GitHub Actions Workflow

Erstellen der Workflow YAML file for automated diagram generation.

# .github/workflows/update-workflow-diagram.yml
name: Update Workflow Diagram

on:
  push:
    branches: [main]
    paths:
      - 'R/**'
      - 'src/**'
      - 'scripts/**'

permissions:
  contents: write

jobs:
  update-diagram:
    if: github.actor != 'github-actions[bot]'
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4

      - uses: r-lib/actions/setup-r@v2
        with:
          use-public-rspm: true

      - name: Install putior
        run: |
          install.packages("putior")
        shell: Rscript {0}

      - name: Generate workflow diagram
        run: |
          Rscript scripts/generate-workflow-diagram.R

      - name: Commit updated diagram
        run: |
          git config --local user.name "github-actions[bot]"
          git config --local user.email "github-actions[bot]@users.noreply.github.com"
          git add README.md docs/workflow.md  # Adjust to match your target files
          git diff --staged --quiet || git commit -m "docs: update workflow diagram [skip ci]"
          git push

Erwartet: File created at .github/workflows/update-workflow-diagram.yml.

Bei Fehler: Sicherstellen the .github/workflows/ directory exists. Anpassen the paths filter to match where annotated Quelldateis live in das Repository.

Schritt 2: Schreiben Generation Script

Erstellen the R script that generates the diagram and updates target files using sentinel markers.

# scripts/generate-workflow-diagram.R
library(putior)

# Scan source files for annotations (exclude build scripts to avoid circular refs)
workflow <- put_merge("./R/", merge_strategy = "supplement",
  exclude = c("generate-workflow-diagram\\.R$"),
  log_level = NULL)  # Set to "DEBUG" to troubleshoot CI diagram generation

# Generate Mermaid code
mermaid_code <- put_diagram(workflow, output = "raw", theme = "github")

# Read target file (e.g., README.md)
readme <- readLines("README.md")

# Find sentinel markers
start_marker <- "<!-- PUTIOR-WORKFLOW-START -->"
end_marker <- "<!-- PUTIOR-WORKFLOW-END -->"

start_idx <- which(readme == start_marker)
end_idx <- which(readme == end_marker)

if (length(start_idx) == 1 && length(end_idx) == 1 && end_idx > start_idx) {
  # Replace content between sentinels
  new_content <- c(
    readme[1:start_idx],
    "",
    "```mermaid",
    mermaid_code,
    "```",
    "",
    readme[end_idx:length(readme)]
  )
  writeLines(new_content, "README.md")
  cat("Updated README.md workflow diagram\n")
} else {
  warning("Sentinel markers not found in README.md. Add them manually:\n",
          start_marker, "\n", end_marker)
}

# Also write standalone diagram file
writeLines(
  c("# Workflow Diagram", "",
    "```mermaid", mermaid_code, "```"),
  "docs/workflow.md"
)
cat("Updated docs/workflow.md\n")

Erwartet: Script at scripts/generate-workflow-diagram.R that reads annotations, generates Mermaid code, and replaces content zwischen sentinel markers.

Bei Fehler: If put_merge() returns empty, check that source paths match das Repository layout. Anpassen "./R/" to the actual source directory.

Schritt 3: Konfigurieren Auto-Commit

The workflow must avoid infinite loops where an auto-commit re-triggers the same workflow. Pushes made with the default GITHUB_TOKEN typischerweise nicht trigger new workflow runs, but der Workflow also includes an explicit if: guard on the job as a safety net.

Key configuration points:

  • Berechtigungs: contents: write grants push access
  • if: github.actor != 'github-actions[bot]' skips the job when the push came from the bot itself
  • git diff --staged --quiet || git commit only commits if there are changes
  • [skip ci] in the commit message is a convention some CI systems honor (not built into GitHub Actions, but useful as a signal)
  • Bot identity used for commits: github-actions[bot]

Erwartet: The workflow only commits when diagrams actually change. No empty commits, no infinite loops.

Bei Fehler: If push fails with Berechtigung denied, check repository settings: Settings > Actions > General > Workflow Berechtigungs muss set to "Lesen and write Berechtigungs".

Schritt 4: Hinzufuegen Sentinel Markers to README

Insert sentinel markers in das Ziel file where the diagram should appear.

## Workflow

<!-- PUTIOR-WORKFLOW-START -->
<!-- This section is auto-generated by putior CI. Do not edit manually. -->

```mermaid
flowchart TD
  A["Placeholder — wird replaced on next CI run"]
<!-- PUTIOR-WORKFLOW-END -->

**Erwartet:** Sentinel markers in README.md (or other target file). The content zwischen them wird replaced on each CI run.

**Bei Fehler:** Sicherstellen markers are on their own lines with no leading/trailing whitespace. The script matches exact line content.

### Schritt 5: Testen the Pipeline

Ausloesen der Workflow and verify the diagram updates.

```bash
# Make a small change to trigger the workflow
echo "# test" >> R/some-file.R
git add R/some-file.R
git commit -m "test: trigger workflow diagram update"
git push

# Monitor the GitHub Actions run
gh run watch

# Verify the diagram was updated
git pull
cat README.md | grep -A 5 "PUTIOR-WORKFLOW-START"

Erwartet: GitHub Actions run completes erfolgreich. The diagram zwischen sentinel markers in README.md is updated with current workflow data.

Bei Fehler: Check the Actions log for errors. Common issues:

  • putior package not available: add to DESCRIPTION Suggests or install explicitly in der Workflow
  • Source path wrong: the R script's put_merge() path muss relative to the repo root
  • No sentinel markers: the script warns but doesn't crash; add markers to README.md

Validierung

  • .github/workflows/update-workflow-diagram.yml exists and is valid YAML
  • scripts/generate-workflow-diagram.R runs ohne errors locally
  • README.md contains <!-- PUTIOR-WORKFLOW-START --> and <!-- PUTIOR-WORKFLOW-END --> sentinels
  • GitHub Actions workflow triggers on push to the correct branch and paths
  • Diagram content zwischen sentinels is updated nach a workflow run
  • Job-level if: guard prevents infinite commit loops from bot pushes
  • No changes = no commit (idempotent)

Haeufige Stolperfallen

  • Infinite CI loops: Pushes with the default GITHUB_TOKEN typischerweise don't trigger new runs, but always add an explicit if: github.actor != 'github-actions[bot]' guard on the job. The [skip ci] tag in the commit message is a useful convention but ist nicht a built-in GitHub Actions mechanism.
  • Permission denied on push: GitHub Actions needs write Berechtigung. Set Berechtigungs: contents: write in der Workflow file, or configure it in repository settings.
  • Sentinel marker mismatch: If markers have trailing spaces, leading tabs, or are on the same line as other content, the script won't find them. Keep markers on their own clean lines.
  • Source path mismatch: The R script runs from the repo root. Paths like "./R/" or "./src/" must match the actual Verzeichnisstruktur.
  • Package installation in CI: If das Projekt uses renv, the CI workflow needs renv::restore() vor putior ist verfuegbar. Alternatively, install putior explicitly in der Workflow.
  • Large repos slowing CI: For repos with many Quelldateis, limit the paths trigger filter to directories that contain PUT annotations, not the entire repo.

Verwandte Skills

  • generate-workflow-diagram — the manual version of what this CI automates
  • setup-github-actions-ci — general GitHub Actions CI/CD setup for R packages
  • build-ci-cd-pipeline — broader CI/CD pipeline design
  • annotate-source-files — annotations must exist vor CI can generate diagrams
  • commit-changes — understanding auto-commit patterns

GitHub 仓库

pjt222/agent-almanac
路径: i18n/de/skills/setup-putior-ci
0
agentsagentskillsai-assisted-developmentclaude-codeskillsteams

相关推荐技能

content-collections

Content Collections 是一个 TypeScript 优先的构建工具,可将本地 Markdown/MDX 文件转换为类型安全的数据集合。它专为构建博客、文档站和内容密集型 Vite+React 应用而设计,提供基于 Zod 的自动模式验证。该工具涵盖从 Vite 插件配置、MDX 编译到生产环境部署的完整工作流。

查看技能

polymarket

这个Claude Skill为开发者提供完整的Polymarket预测市场开发支持,涵盖API调用、交易执行和市场数据分析。关键特性包括实时WebSocket数据流,可监控实时交易、订单和市场动态。开发者可用它构建预测市场应用、实施交易策略并集成实时市场预测功能。

查看技能

creating-opencode-plugins

该Skill帮助开发者创建OpenCode插件,用于接入命令、文件、LSP等25+种事件。它提供了插件结构、事件API规范和JavaScript/TypeScript实现模式,适合需要拦截操作、扩展功能或自定义事件处理的场景。开发者可通过它快速构建响应式模块来增强OpenCode AI助手的能力。

查看技能

sglang

SGLang是一个专为LLM设计的高性能推理框架,特别适用于需要结构化输出的场景。它通过RadixAttention前缀缓存技术,在处理JSON、正则表达式、工具调用等具有重复前缀的复杂工作流时,能实现极速生成。如果你正在构建智能体或多轮对话系统,并追求远超vLLM的推理性能,SGLang是理想选择。

查看技能