Skip to content

Commit bf3b5c7

Browse files
committed
Revert "Revert "cancel run early if changelogs exists""
This reverts commit 3ecb278.
1 parent 3ecb278 commit bf3b5c7

File tree

1 file changed

+19
-17
lines changed

1 file changed

+19
-17
lines changed

.github/workflows/changelog.yml

Lines changed: 19 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,16 @@ jobs:
1111
steps:
1212
- name: Get current date
1313
id: date
14-
run: echo "::set-output name=date::$(date +'%Y-%m-%d')"
14+
run: |
15+
echo "TODAY=$(date +'%Y-%m-%d')" >> ${GITHUB_ENV}
16+
echo "LOG_FILES=fern/apis/*/changelog/$TODAY.md" >> ${GITHUB_ENV}
17+
- name: Check changelog
18+
run: |
19+
if ls $LOG_FILES >/dev/null 2>&1; then
20+
l=($LOG_FILES)
21+
echo "${l[@]} already exist."
22+
gh run cancel
23+
fi
1524
- name: Check out repository content
1625
uses: actions/checkout@v2
1726
with:
@@ -35,33 +44,26 @@ jobs:
3544
base: 'base/fern/apis/public/openapi-public.yaml'
3645
revision: 'head/fern/apis/public/openapi-public.yaml'
3746
format: text
38-
output-to-file: 'temp/public/${{ steps.date.outputs.date }}_oasdiff.md'
47+
output-to-file: 'temp/public/${{ env.TODAY }}_oasdiff.md'
3948
- name: Running beta OpenAPI Spec diff action
4049
uses: oasdiff/oasdiff-action/diff@main
4150
with:
4251
base: 'base/fern/apis/beta/openapi-beta.yaml'
4352
revision: 'head/fern/apis/beta/openapi-beta.yaml'
4453
format: text
45-
output-to-file: 'temp/beta/${{ steps.date.outputs.date }}_oasdiff.md'
54+
output-to-file: 'temp/beta/${{ env.TODAY }}_oasdiff.md'
4655
- name: Archive changelogs
4756
uses: actions/upload-artifact@v4
4857
with:
49-
name: changelog-${{ steps.date.outputs.date }}
58+
name: changelog-${{ env.TODAY }}
5059
path: temp/**
5160
- name: Prompt
5261
env:
5362
LLM_JWT: ${{ secrets.LLM_JWT }}
5463
run: |
55-
logfiles="fern/apis/*/changelog/${{ steps.date.outputs.date }}.md"
56-
57-
if ls $logfiles >/dev/null 2>&1; then
58-
logfiles=($logfiles)
59-
echo "${logfiles[@]} already exist."
60-
else
61-
python changelog.py --date ${{ steps.date.outputs.date }}
62-
git config user.name github-actions
63-
git config user.email [email protected]
64-
git add fern/apis/*/changelog/${{ steps.date.outputs.date }}.md
65-
git commit -m "generated by Claude"
66-
git push
67-
fi
64+
python changelog.py --date ${{ env.TODAY }}
65+
git config user.name github-actions
66+
git config user.email [email protected]
67+
git add ${{ env.LOG_FILES }}
68+
git commit -m "generated by Claude"
69+
git push

0 commit comments

Comments
 (0)