Skip to content

Commit 1d34983

Browse files
authored
Merge pull request #27 from chez-shanpu/fix-krew-workflow
Change krew manifest workflow to create PR instead of pushing directly to main
2 parents 3005a05 + 048044a commit 1d34983

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

.github/workflows/update-krew-manifest.yml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ on:
88

99
permissions:
1010
contents: write
11+
pull-requests: write
1112

1213
jobs:
1314
update-krew-manifest:
@@ -32,14 +33,23 @@ jobs:
3233
- name: Update krew manifest
3334
run: ./scripts/update-krew-manifest.sh ${{ steps.get_version.outputs.VERSION }}
3435

35-
- name: Commit and push
36+
- name: Create Pull Request
3637
run: |
3738
git config user.name "github-actions[bot]"
3839
git config user.email "github-actions[bot]@users.noreply.github.com"
3940
git add plugins/mft.yaml
4041
if git diff --staged --quiet; then
4142
echo "No changes to commit"
4243
else
44+
BRANCH_NAME="chore/update-krew-manifest-${{ steps.get_version.outputs.VERSION }}"
45+
git checkout -b "$BRANCH_NAME"
4346
git commit -m "chore: update krew manifest for ${{ steps.get_version.outputs.VERSION }}"
44-
git push origin main
47+
git push origin "$BRANCH_NAME"
48+
gh pr create \
49+
--title "chore: update krew manifest for ${{ steps.get_version.outputs.VERSION }}" \
50+
--body "This PR updates the krew manifest for version ${{ steps.get_version.outputs.VERSION }}." \
51+
--base main \
52+
--head "$BRANCH_NAME"
4553
fi
54+
env:
55+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)