-
Notifications
You must be signed in to change notification settings - Fork 0
100 lines (83 loc) · 3.51 KB
/
Copy pathcomplete-feature.yml
File metadata and controls
100 lines (83 loc) · 3.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Complete Feature
# Automatically moves LLM history from active/ to completed/ when a PR is merged into develop.
on:
pull_request:
types: [closed]
branches: [develop]
# Prevent concurrent pushes to target branch - queue instead of cancel
concurrency:
group: push-${{ github.event.pull_request.base.ref }}
cancel-in-progress: false
jobs:
complete-history:
# Only run if PR was merged (not just closed)
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Generate GitHub App token
id: app-token
uses: actions/create-github-app-token@v3
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.base.ref }}
fetch-depth: 0
token: ${{ steps.app-token.outputs.token }}
persist-credentials: false
- name: Extract feature name from branch
id: feature
run: |
BRANCH="${{ github.event.pull_request.head.ref }}"
# Extract feature name (remove prefix like feature/, fix/, etc.)
FEATURE_NAME=$(echo "$BRANCH" | sed 's|^[^/]*/||')
echo "name=$FEATURE_NAME" >> $GITHUB_OUTPUT
echo "branch=$BRANCH" >> $GITHUB_OUTPUT
- name: Check for LLM history
id: check
run: |
FEATURE_NAME="${{ steps.feature.outputs.name }}"
HISTORY_DIR=".llm/history/active/$FEATURE_NAME"
if [[ -d "$HISTORY_DIR" ]]; then
echo "found=true" >> $GITHUB_OUTPUT
echo "Found history directory: $HISTORY_DIR"
else
echo "found=false" >> $GITHUB_OUTPUT
echo "No LLM history found for feature: $FEATURE_NAME"
echo "This is normal if LLM assistance wasn't used."
fi
- name: Complete feature history
if: steps.check.outputs.found == 'true'
run: |
FEATURE_NAME="${{ steps.feature.outputs.name }}"
HISTORY_DIR=".llm/history/active/$FEATURE_NAME"
DATE=$(date +%Y-%m)
mkdir -p ".llm/history/completed/$DATE"
# Update completion date in all markdown files
for file in "$HISTORY_DIR"/*.md; do
if [[ -f "$file" ]]; then
sed -i "s/Completed: In Progress/Completed: $(date +%Y-%m-%d)/" "$file"
fi
done
# Move directory to completed
mv "$HISTORY_DIR" ".llm/history/completed/$DATE/"
echo "✓ Moved to .llm/history/completed/$DATE/$FEATURE_NAME/"
- name: Commit and push
if: steps.check.outputs.found == 'true'
env:
GH_TOKEN: ${{ steps.app-token.outputs.token }}
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
# Configure remote URL with GitHub App token for authenticated push
git remote set-url origin https://x-access-token:${GH_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git add .llm/history/
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit --no-verify -m "chore: complete LLM history for ${{ steps.feature.outputs.name }} [bot]"
# Pull latest changes (in case i18n workflow pushed)
git pull --rebase origin ${{ github.event.pull_request.base.ref }} || true
git push --no-verify origin ${{ github.event.pull_request.base.ref }}
fi