Skip to content

Commit a5410f5

Browse files
committed
ci: fix sync workflow
- Update peter-evans/create-pull-request to v7 - Move file updates before PR creation - Remove non-existent 'sync' label - Remove redundant fallback PR creation
1 parent 4cbc757 commit a5410f5

1 file changed

Lines changed: 14 additions & 48 deletions

File tree

.github/workflows/sync-postypes.yaml

Lines changed: 14 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,18 @@ jobs:
8080
echo "added=$ADDED" >> $GITHUB_OUTPUT
8181
echo "removed=$REMOVED" >> $GITHUB_OUTPUT
8282
83+
- name: Update files
84+
if: steps.extract.outputs.changed == 'true'
85+
run: |
86+
# Replace postype.go with generated version
87+
mv postype_generated.go postype.go
88+
89+
# Update Makefile version
90+
sed -i "s/KIWI_VERSION := .*/KIWI_VERSION := ${{ steps.get_version.outputs.version }}/" Makefile
91+
8392
- name: Create Pull Request
8493
if: steps.extract.outputs.changed == 'true'
85-
uses: peter-evans/create-pull-request@v6
94+
uses: peter-evans/create-pull-request@v7
8695
with:
8796
token: ${{ secrets.GITHUB_TOKEN }}
8897
commit-message: "sync: update POS tags from Kiwi ${{ steps.get_version.outputs.version }}"
@@ -95,8 +104,8 @@ jobs:
95104
This PR was automatically generated by the POS tag sync workflow.
96105
97106
### Changes
98-
- Added: ${{ steps.extract.outputs.added }} lines
99-
- Removed: ${{ steps.extract.outputs.removed }} lines
107+
- Added: ${{ steps.diff.outputs.added }} lines
108+
- Removed: ${{ steps.diff.outputs.removed }} lines
100109
101110
### Diff Summary
102111
```
@@ -111,60 +120,17 @@ jobs:
111120
---
112121
*This PR was created by [sync-postypes.yaml](.github/workflows/sync-postypes.yaml)*
113122
labels: |
114-
sync
115123
automated
116124
117-
- name: Update Makefile version
118-
if: steps.extract.outputs.changed == 'true'
119-
run: |
120-
sed -i "s/KIWI_VERSION := .*/KIWI_VERSION := ${{ steps.get_version.outputs.version }}/" Makefile
121-
122-
- name: Commit and push changes
123-
if: steps.extract.outputs.changed == 'true'
124-
run: |
125-
git config user.name "github-actions[bot]"
126-
git config user.email "github-actions[bot]@users.noreply.github.com"
127-
128-
# Replace postype.go with generated version
129-
mv postype_generated.go postype.go
130-
131-
# Stage changes
132-
git add postype.go Makefile
133-
134-
# Check if there are changes to commit
135-
if git diff --staged --quiet; then
136-
echo "No changes to commit"
137-
else
138-
git commit -m "sync: update POS tags from Kiwi ${{ steps.get_version.outputs.version }}"
139-
git push origin sync/postypes-${{ steps.get_version.outputs.version }}
140-
fi
141-
142-
- name: Create PR manually (fallback)
143-
if: steps.extract.outputs.changed == 'true' && failure()
144-
env:
145-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
146-
run: |
147-
# Fallback: create PR using gh CLI
148-
gh pr create \
149-
--title "sync: update POS tags from Kiwi ${{ steps.get_version.outputs.version }}" \
150-
--body "## POS Tag Sync from Kiwi ${{ steps.get_version.outputs.version }}
151-
152-
Automatically generated PR to sync POS tags with upstream Kiwi.
153-
154-
**Changes**: +${{ steps.extract.outputs.added }} -${{ steps.extract.outputs.removed }}" \
155-
--label "sync,automated" \
156-
--head sync/postypes-${{ steps.get_version.outputs.version }} \
157-
--base main
158-
159125
- name: Summary
160126
if: always()
161127
run: |
162128
echo "## Sync Summary" >> $GITHUB_STEP_SUMMARY
163129
echo "- Kiwi Version: ${{ steps.get_version.outputs.version }}" >> $GITHUB_STEP_SUMMARY
164130
echo "- Changes Detected: ${{ steps.extract.outputs.changed }}" >> $GITHUB_STEP_SUMMARY
165131
if [ "${{ steps.extract.outputs.changed }}" == "true" ]; then
166-
echo "- Added: ${{ steps.extract.outputs.added }} lines" >> $GITHUB_STEP_SUMMARY
167-
echo "- Removed: ${{ steps.extract.outputs.removed }} lines" >> $GITHUB_STEP_SUMMARY
132+
echo "- Added: ${{ steps.diff.outputs.added }} lines" >> $GITHUB_STEP_SUMMARY
133+
echo "- Removed: ${{ steps.diff.outputs.removed }} lines" >> $GITHUB_STEP_SUMMARY
168134
echo "- PR Created: Yes" >> $GITHUB_STEP_SUMMARY
169135
else
170136
echo "- Status: Already in sync" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)