mirror of
https://github.com/android/skills.git
synced 2026-09-14 20:07:09 +08:00
Merge pull request #2 from android/ja/workflow-improvements
Improve reliability of the update-skills workflow
This commit is contained in:
@@ -2,6 +2,9 @@ name: Update Skills
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
# TODO(JoseAlcerreca): enable schedule when ready
|
||||
# schedule:
|
||||
# - cron: '0 * * * *' # Runs at minute 0 of every hour
|
||||
|
||||
permissions:
|
||||
contents: write
|
||||
@@ -10,32 +13,38 @@ jobs:
|
||||
update-skills:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout main-tests
|
||||
- name: Checkout main
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: main-tests
|
||||
ref: main
|
||||
token: ${{ secrets.ADR_GITHUB_BOT_PAT }}
|
||||
|
||||
- name: Delete every directory that doesn't start with a dot
|
||||
- name: Delete existing non-hidden directories
|
||||
run: |
|
||||
# Cleans up existing folders so we don't have stale files
|
||||
find . -mindepth 1 -maxdepth 1 -type d ! -name '.*' -exec rm -rf {} +
|
||||
|
||||
- name: Download dac_skills.zip
|
||||
run: curl -O https://dl.google.com/dac/dac_skills.zip
|
||||
|
||||
- name: Extract zip file
|
||||
- name: Download and Extract dac_skills
|
||||
run: |
|
||||
unzip dac_skills.zip
|
||||
curl -L -O https://dl.google.com/dac/dac_skills.zip
|
||||
unzip -o dac_skills.zip
|
||||
rm dac_skills.zip
|
||||
|
||||
- name: Copy contents of github-only branch
|
||||
- name: Copy contents of github-skills branch
|
||||
run: |
|
||||
git fetch origin github-only
|
||||
git checkout origin/github-only -- .
|
||||
git fetch origin github-skills
|
||||
# We use a subshell check to prevent errors if no folders match
|
||||
if ls -d [!.]*/ >/dev/null 2>&1; then
|
||||
git checkout origin/github-skills -- [!.]*/
|
||||
else
|
||||
echo "No non-hidden directories found in github-skills branch."
|
||||
fi
|
||||
|
||||
- name: Commit and push changes
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||
git config user.name "android-devrel-github-bot"
|
||||
git config user.email "android-devrel-github-bot@users.noreply.github.com"
|
||||
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"
|
||||
git push origin HEAD:main-tests
|
||||
git push origin main
|
||||
|
||||
Reference in New Issue
Block a user