mirror of
https://github.com/android/skills.git
synced 2026-09-14 20:07:09 +08:00
Update the Update Skills action to create a PR instead of merging to main directly (#161)
This commit is contained in:
@@ -8,6 +8,7 @@ on:
|
|||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-skills:
|
update-skills:
|
||||||
@@ -100,11 +101,27 @@ jobs:
|
|||||||
f.write('\n')
|
f.write('\n')
|
||||||
"
|
"
|
||||||
|
|
||||||
- name: Commit and push changes
|
- name: Commit and push to PR branch
|
||||||
run: |
|
run: |
|
||||||
|
BRANCH="update-skills/$(date +'%Y-%m-%d-%H%M')"
|
||||||
|
|
||||||
git config user.name "android-devrel-github-bot"
|
git config user.name "android-devrel-github-bot"
|
||||||
git config user.email "android-devrel-github-bot@users.noreply.github.com"
|
git config user.email "android-devrel-github-bot@users.noreply.github.com"
|
||||||
|
git checkout -b "$BRANCH"
|
||||||
git add -A
|
git add -A
|
||||||
# The '|| true' ensures the workflow doesn't fail if there's nothing new
|
|
||||||
git commit -m "Updates skills ($(date +'%Y-%m-%d %H:%M'))" || echo "No changes to commit"
|
# The workflow doesn't fail if there's nothing new to commit
|
||||||
git push origin main
|
if git diff --cached --quiet; then
|
||||||
|
echo "No changes to commit — skipping PR creation."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
git commit -m "Updates skills ($(date +'%Y-%m-%d %H:%M'))"
|
||||||
|
git push origin "$BRANCH"
|
||||||
|
gh pr create \
|
||||||
|
--title "Update skills ($(date +'%Y-%m-%d %H:%M'))" \
|
||||||
|
--body "Automated skill update from the \`Update Skills\` workflow. Please review the changes before merging." \
|
||||||
|
--base main \
|
||||||
|
--head "$BRANCH"
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ secrets.ADR_GITHUB_BOT_PAT }}
|
||||||
Reference in New Issue
Block a user