mirror of
https://github.com/community-scripts/ProxmoxVE
synced 2025-03-10 07:30:28 +00:00
parent
5c5c628954
commit
05769fdff1
34
.github/workflows/script-test.yml
vendored
34
.github/workflows/script-test.yml
vendored
@ -140,34 +140,38 @@ jobs:
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|
||||||
- name: Post error comments
|
- name: Post error comments
|
||||||
run: |
|
run: |
|
||||||
ERROR="false"
|
ERROR="false"
|
||||||
SEARCH_LINE=".github/workflows/scripts/app-test/pr-build.func: line 255"
|
SEARCH_LINE=".github/workflows/scripts/app-test/pr-build.func: line 255:"
|
||||||
|
|
||||||
|
# Get all existing comments on the PR
|
||||||
|
EXISTING_COMMENTS=$(gh pr view ${{ github.event.pull_request.number }} --repo ${{ github.repository }} --json comments --jq '.comments[].body')
|
||||||
|
|
||||||
for FILE in ${{ env.ALL_FILES }}; do
|
for FILE in ${{ env.ALL_FILES }}; do
|
||||||
STRIPPED_NAME=$(basename "$FILE" | sed 's/-install//' | sed 's/\.sh$//')
|
STRIPPED_NAME=$(basename "$FILE" | sed 's/-install//' | sed 's/\.sh$//')
|
||||||
if [[ ! -f result_$STRIPPED_NAME.log ]]; then
|
if [[ ! -f result_$STRIPPED_NAME.log ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
ERROR_MSG=$(cat result_$STRIPPED_NAME.log)
|
ERROR_MSG=$(cat result_$STRIPPED_NAME.log)
|
||||||
|
|
||||||
if [ -n "$ERROR_MSG" ]; then
|
if [ -n "$ERROR_MSG" ]; then
|
||||||
CLEANED_ERROR_MSG=$(echo "$ERROR_MSG" | sed "s|$SEARCH_LINE.*||")
|
CLEANED_ERROR_MSG=$(echo "$ERROR_MSG" | sed "s|$SEARCH_LINE.*||")
|
||||||
echo "Posting error message for $FILE"
|
COMMENT_BODY=":warning: The script _**$FILE**_ failed with the following message: <br> <div><strong>${CLEANED_ERROR_MSG}</strong></div>"
|
||||||
echo ${CLEANED_ERROR_MSG}
|
|
||||||
gh pr comment ${{ github.event.pull_request.number }} \
|
# Check if the comment already exists
|
||||||
--repo ${{ github.repository }} \
|
if echo "$EXISTING_COMMENTS" | grep -qF "$COMMENT_BODY"; then
|
||||||
--body ":warning: The script _**$FILE**_ failed with the following message: <br> <div><strong>${CLEANED_ERROR_MSG}</strong></div>"
|
echo "Skipping duplicate comment for $FILE"
|
||||||
ERROR="true"
|
else
|
||||||
|
echo "Posting error message for $FILE"
|
||||||
|
gh pr comment ${{ github.event.pull_request.number }} \
|
||||||
|
--repo ${{ github.repository }} \
|
||||||
|
--body "$COMMENT_BODY"
|
||||||
|
ERROR="true"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
echo "ERROR=$ERROR" >> $GITHUB_ENV
|
echo "ERROR=$ERROR" >> $GITHUB_ENV
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Fail if error
|
|
||||||
if: ${{ env.ERROR == 'true' }}
|
|
||||||
run: exit 1
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user