Optimize update workflow steps and execution order
Run tests before updating metadata, and combine Git configuration, commit, and push into a single step. Validating the downloaded dictionary file immediately after change detection ensures tests fail-fast before metadata is modified or staged. Combining Git setup, commit, and push reduces workflow step clutter and avoids unnecessary Git configuration on runs with no changes.
This commit is contained in:
1 parent
d352136e3d
commit
ddc2ac84aa
1 file changed
+6
-11
@@ -25,10 +25,6 @@ jobs:
|
||||
timeout-minutes: 5
|
||||
steps:
|
||||
- uses: "actions/checkout@v7"
|
||||
- name: "Configure Git"
|
||||
run: |
|
||||
git config user.name "Rodolfo Carvalho"
|
||||
git config user.email "88819+rhcarvalho@users.noreply.github.com"
|
||||
- name: "Download"
|
||||
run: |
|
||||
URL='https://www.mdbg.net/chinese/export/cedict/cedict_1_0_ts_utf-8_mdbg.txt.gz'
|
||||
@@ -39,20 +35,19 @@ jobs:
|
||||
git add -- cedict_1_0_ts_utf-8_mdbg.txt
|
||||
git diff --cached --stat
|
||||
echo "changed=$(git diff --cached --quiet; echo $?)" >> "$GITHUB_OUTPUT"
|
||||
- name: "Test"
|
||||
if: "fromJSON(steps.diff.outputs.changed)"
|
||||
run: "go test -v -count=1"
|
||||
- name: "Update metadata"
|
||||
if: "fromJSON(steps.diff.outputs.changed)"
|
||||
run: |
|
||||
awk -f meta -v RS='\r\n' cedict_1_0_ts_utf-8_mdbg.txt >> meta.csv
|
||||
git add -- meta.csv
|
||||
- name: "Commit"
|
||||
- name: "Commit and push"
|
||||
if: "fromJSON(steps.diff.outputs.changed)"
|
||||
run: |
|
||||
git config user.name "Rodolfo Carvalho"
|
||||
git config user.email "88819+rhcarvalho@users.noreply.github.com"
|
||||
RELEASE_DATE="$(awk -f release_date -v RS='\r\n' cedict_1_0_ts_utf-8_mdbg.txt)"
|
||||
git commit -m "CC-CEDICT ${RELEASE_DATE}"
|
||||
- name: "Test"
|
||||
if: "fromJSON(steps.diff.outputs.changed)"
|
||||
run: "go test -v -count=1"
|
||||
- name: Push
|
||||
if: "fromJSON(steps.diff.outputs.changed)"
|
||||
run: |
|
||||
git push
|
||||
Reference in new issue
Block a user