Skip to content

Commit

Permalink
check status
Browse files Browse the repository at this point in the history
  • Loading branch information
tranphuocloc070699 committed Jul 28, 2023
1 parent 994ddcf commit 9672606
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
20 changes: 20 additions & 0 deletions .github/workflows/backend-cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,26 @@ jobs:
format: html
disable_web_page_preview: true

- name: Check last job status
id: lastJobStatus
if: always()
run: |
LAST_JOB_STATUS=$(gh run list --workflow backend-cd.yaml | grep -oh "completed.*" | head -1 | awk '{print $2}')
THIS_JOB_STATUS="${{ job.status }}"
if [ "$LAST_JOB_STATUS" != "$THIS_JOB_STATUS" ]; then
echo "status changed from $LAST_JOB_STATUS to $THIS_JOB_STATUS"
echo "::set-output name=changedState::true"
echo "::set-output name=stateMessage::Test status changed from '$LAST_COMPLETED_JOB_STATUS' to '$THIS_JOB_STATUS'."
else
echo "status is still $THIS_JOB_STATUS"
echo "::set-output name=changedState::false"
echo "::set-output name=stateMessage::$THIS_JOB_STATUS"
fi
- name: Showcase output variable
if: always() && steps.lastJobStatus.outputs.changedState == 'true'
run: echo "CHANGED STATE!!!"

send-telegram-message:
needs: deploy
runs-on: ubuntu-latest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ public class ServerApplication {
public static void main(String[] args) {

SpringApplication.run(ServerApplication.class, args);
String a = "a";
String a = "abcxyz";


}

}

0 comments on commit 9672606

Please sign in to comment.