Skip to content

Commit

Permalink
ci: fix ident
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveLauC committed Apr 13, 2024
1 parent 844c146 commit fcad9a3
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions .github/actions/check_changelog/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,37 @@ runs:
using: "composite"
steps:
- name: Get newly added CHANGELOGs
id: new-changelogs
uses: tj-actions/changed-files@v44
with:
# Only checek the files under the `changelog` directory
files: changelog/**
id: new-changelogs
uses: tj-actions/changed-files@v44
with:
# Only checek the files under the `changelog` directory
files: changelog/**

- name: List added CHANGELOGs
if: steps.new-changelogs.outputs.added_files_count != 0
env:
NEW_CHANGELOGS: ${{ steps.new-changelogs.outputs.added_files }}
PR_NUMBER: ${{ github.event.number }}
run: |
for cl in ${NEW_CHANGELOGS}; do
# parse it
IFS='.' read id kind file_extension <<< "${cl}"
if: steps.new-changelogs.outputs.added_files_count != 0
env:
NEW_CHANGELOGS: ${{ steps.new-changelogs.outputs.added_files }}
PR_NUMBER: ${{ github.event.number }}
run: |
for cl in ${NEW_CHANGELOGS}; do
# parse it
IFS='.' read id kind file_extension <<< "${cl}"
# Check the kind field
if [ "$kind" != "added" ] && [ "$kind" != "changed" ] && [ "$kind" != "fixed" ] && [ "$kind" != "removed" ]; then
echo "Invalid CHANGELOG kind [${kind}] from [${cl}], available options are [added, changed, fixed, removed]";
exit 1;
fi
# Check the kind field
if [ "$kind" != "added" ] && [ "$kind" != "changed" ] && [ "$kind" != "fixed" ] && [ "$kind" != "removed" ]; then
echo "Invalid CHANGELOG kind [${kind}] from [${cl}], available options are [added, changed, fixed, removed]";
exit 1;
fi
# Check the file extension
if [ "$file_extension" != "md" ]; then
echo "Invalid file extension [${file_extension}] from [${cl}], it should be [md]";
exit 1;
fi
# Check the file extension
if [ "$file_extension" != "md" ]; then
echo "Invalid file extension [${file_extension}] from [${cl}], it should be [md]";
exit 1;
fi
# Check PR number
if [ "$id" != "$PR_NUMBER" ]; then
echo "Mismatched PR number [${id}] from [${cl}], it should be ${PR_NUMBER}";
exit 1;
fi
done
# Check PR number
if [ "$id" != "$PR_NUMBER" ]; then
echo "Mismatched PR number [${id}] from [${cl}], it should be ${PR_NUMBER}";
exit 1;
fi
done

0 comments on commit fcad9a3

Please sign in to comment.