fix getting number of tech.issue for notifications to static number 1 (filter on tag doesn't work)

This commit is contained in:
Nadezhda Fedorova 2024-04-23 13:35:41 +03:00
parent 28b280556b
commit 86fba1814f
2 changed files with 18 additions and 26 deletions

View File

@ -66,12 +66,10 @@ jobs:
- name: Send notification if build crashed - name: Send notification if build crashed
if: ${{ steps.build-script.outcome != 'success' }} if: ${{ steps.build-script.outcome != 'success' }}
run: | run: |
issueid=$(curl -X 'GET' "$URL/api/v1/repos/$REPO/image-forge/issues?state=open&labels=building&type=issues&page=1&limit=1&token=$T" -H 'accept: application/json' -s | jq '.[].number' -r) issueid=1
if [[ $issueid != '' ]]; then \ body="Building images finish with some errors."
body="Building images finish with some errors."; \ curl -X 'POST' "$URL/api/v1/repos/$REPO/image-forge/issues/$issueid/comments?token=$T" -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"body\": \"$body\" }" -s
curl -X 'POST' "$URL/api/v1/repos/$REPO/image-forge/issues/$issueid/comments?token=$T" -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"body\": \"$body\" }" -s;\ echo "notification about test error is sent to issue $issueid"
echo "notification about test error is sent to issue $issueid"; \
else echo "no issue to send notification"; fi
env: env:
T: ${{ secrets.TOKEN }} T: ${{ secrets.TOKEN }}
BR: ${{ env.BRANCH }} BR: ${{ env.BRANCH }}
@ -117,13 +115,11 @@ jobs:
- name: Send notification if test crashed - name: Send notification if test crashed
if: ${{ env.ERR == 'true' || steps.test-script.outcome == 'failure' }} if: ${{ env.ERR == 'true' || steps.test-script.outcome == 'failure' }}
run: | run: |
issueid=$(curl -X 'GET' "$URL/api/v1/repos/$REPO/image-forge/issues?state=open&labels=building&type=issues&page=1&limit=1&token=$T" -H 'accept: application/json' -s | jq '.[].number' -r) issueid=1
if [[ $issueid != '' ]]; then \ errors=$(cat errors.log)
errors=$(cat errors.log); \ body="Testing images finish with some errors. $errors"
body="Testing images finish with some errors. $errors"; \ curl -X 'POST' "$URL/api/v1/repos/$REPO/image-forge/issues/$issueid/comments?token=$T" -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"body\": \"$body\" }" -s
curl -X 'POST' "$URL/api/v1/repos/$REPO/image-forge/issues/$issueid/comments?token=$T" -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"body\": \"$body\" }" -s; \ echo "notification about test error is sent to issue $issueid"
echo "notification about test error is sent to issue $issueid"; \
else echo "no issue to send notification"; fi
env: env:
T: ${{ secrets.TOKEN }} T: ${{ secrets.TOKEN }}
BR: ${{ needs.build-process.outputs.branch }} BR: ${{ needs.build-process.outputs.branch }}

View File

@ -66,12 +66,10 @@ jobs:
- name: Send notification if build crashed - name: Send notification if build crashed
if: ${{ steps.build-script.outcome != 'success' }} if: ${{ steps.build-script.outcome != 'success' }}
run: | run: |
issueid=$(curl -X 'GET' "$URL/api/v1/repos/$REPO/image-forge/issues?state=open&labels=building&type=issues&page=1&limit=1&token=$T" -H 'accept: application/json' -s | jq '.[].number' -r) issueid=1
if [[ $issueid != '' ]]; then \ body="Building images finish with some errors."
body="Building images finish with some errors."; \ curl -X 'POST' "$URL/api/v1/repos/$REPO/image-forge/issues/$issueid/comments?token=$T" -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"body\": \"$body\" }" -s
curl -X 'POST' "$URL/api/v1/repos/$REPO/image-forge/issues/$issueid/comments?token=$T" -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"body\": \"$body\" }" -s;\ echo "notification about test error is sent to issue $issueid"
echo "notification about test error is sent to issue $issueid"; \
else echo "no issue to send notification"; fi
env: env:
T: ${{ secrets.TOKEN }} T: ${{ secrets.TOKEN }}
BR: ${{ env.BRANCH }} BR: ${{ env.BRANCH }}
@ -117,13 +115,11 @@ jobs:
- name: Send notification if test crashed - name: Send notification if test crashed
if: ${{ env.ERR == 'true' || steps.test-script.outcome == 'failure' }} if: ${{ env.ERR == 'true' || steps.test-script.outcome == 'failure' }}
run: | run: |
issueid=$(curl -X 'GET' "$URL/api/v1/repos/$REPO/image-forge/issues?state=open&labels=building&type=issues&page=1&limit=1&token=$T" -H 'accept: application/json' -s | jq '.[].number' -r) issueid=1
if [[ $issueid != '' ]]; then \ errors=$(cat errors.log)
errors=$(cat errors.log); \ body="Testing images finish with some errors. $errors"
body="Testing images finish with some errors. $errors"; \ curl -X 'POST' "$URL/api/v1/repos/$REPO/image-forge/issues/$issueid/comments?token=$T" -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"body\": \"$body\" }" -s
curl -X 'POST' "$URL/api/v1/repos/$REPO/image-forge/issues/$issueid/comments?token=$T" -H 'accept: application/json' -H 'Content-Type: application/json' -d "{ \"body\": \"$body\" }" -s; \ echo "notification about test error is sent to issue $issueid"
echo "notification about test error is sent to issue $issueid"; \
else echo "no issue to send notification"; fi
env: env:
T: ${{ secrets.TOKEN }} T: ${{ secrets.TOKEN }}
BR: ${{ needs.build-process.outputs.branch }} BR: ${{ needs.build-process.outputs.branch }}