Skip to content

Commit 4cf1654

Browse files
slack pipeline success notify#3
1 parent cac5abd commit 4cf1654

1 file changed

Lines changed: 55 additions & 53 deletions

File tree

.github/workflows/pc.yml

Lines changed: 55 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
name: Secret scanning
2020
runs-on: ubuntu-latest
2121
# continue-on-error: true
22+
needs: start-time-capture
2223
steps:
2324
- name: Checkout Repo
2425
uses: actions/checkout@v4
@@ -130,62 +131,63 @@ jobs:
130131
# },
131132
# ]
132133
# }
133-
# compile:
134-
# name: Compile code
135-
# runs-on: ubuntu-latest
136-
# needs: dependency-scanning
137-
# steps:
138-
# - name: Checkout Repo
139-
# uses: actions/checkout@v4
140-
# - name: Set up JDK
141-
# uses: actions/setup-java@v3
142-
# with:
143-
# java-version: '11.0.25+9'
144-
# distribution: 'temurin'
145-
# - name: Restore Maven packages
146-
# uses: actions/cache/restore@v4
147-
# with:
148-
# path: ~/.m2/repository
149-
# key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
150-
# - name: Compile
151-
# run: mvn clean compile
152-
# - name: Slack notify on failure
153-
# uses: slackapi/slack-github-action@v2.0.0
154-
# if: failure()
155-
# with:
156-
# webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
157-
# webhook-type: incoming-webhook
158-
# payload: |
159-
# {
160-
# "blocks": [
161-
# {
162-
# "type": "section",
163-
# "text": {
164-
# "type": "mrkdwn",
165-
# "text": "*Pipeline Alert! :rotating_light: *",
166-
# }
167-
# },
168-
# {
169-
# "type": "section",
170-
# "text": {
171-
# "type": "mrkdwn",
172-
# "text": ":x: *Job* `${{ github.job }}` in *workflow* `${{ github.workflow }}` has failed"
173-
# }
174-
# },
175-
# {
176-
# "type": "section",
177-
# "text": {
178-
# "type": "mrkdwn",
179-
# "text": ":bust_in_silhouette: Commit of message `${{ github.event.head_commit.message }}` commited by ${{ github.event.head_commit.author.name }} has resulted in the failure of the job\n*Ref*: <${{ github.event.head_commit.url }}|${{ github.sha }}>"
180-
# }
181-
# },
182-
# ]
183-
# }
134+
compile:
135+
name: Compile code
136+
runs-on: ubuntu-latest
137+
# needs: dependency-scanning
138+
needs: secret-scanning
139+
steps:
140+
- name: Checkout Repo
141+
uses: actions/checkout@v4
142+
- name: Set up JDK
143+
uses: actions/setup-java@v3
144+
with:
145+
java-version: '11.0.25+9'
146+
distribution: 'temurin'
147+
- name: Restore Maven packages
148+
uses: actions/cache/restore@v4
149+
with:
150+
path: ~/.m2/repository
151+
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
152+
- name: Compile
153+
run: mvn clean compile
154+
- name: Slack notify on failure
155+
uses: slackapi/slack-github-action@v2.0.0
156+
if: failure()
157+
with:
158+
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
159+
webhook-type: incoming-webhook
160+
payload: |
161+
{
162+
"blocks": [
163+
{
164+
"type": "section",
165+
"text": {
166+
"type": "mrkdwn",
167+
"text": "*Pipeline Alert! :rotating_light: *",
168+
}
169+
},
170+
{
171+
"type": "section",
172+
"text": {
173+
"type": "mrkdwn",
174+
"text": ":x: *Job* `${{ github.job }}` in *workflow* `${{ github.workflow }}` has failed"
175+
}
176+
},
177+
{
178+
"type": "section",
179+
"text": {
180+
"type": "mrkdwn",
181+
"text": ":bust_in_silhouette: Commit of message `${{ github.event.head_commit.message }}` commited by ${{ github.event.head_commit.author.name }} has resulted in the failure of the job\n*Ref*: <${{ github.event.head_commit.url }}|${{ github.sha }}>"
182+
}
183+
},
184+
]
185+
}
184186
test:
185187
name: Unit test and generate code coverage
186188
runs-on: ubuntu-latest
187189
# needs:
188-
needs: secret-scanning
190+
needs: compile
189191
# continue-on-error: true
190192
steps:
191193
- name: Checkout Repo
@@ -492,7 +494,7 @@ jobs:
492494
"type": "section",
493495
"text": {
494496
"type": "mrkdwn",
495-
"text":":watch: *Duration:* ${{ steps.workflow_duration.outputs.MINUTES }} minutes and ${{ steps.workflow_duration.outputs.SECONDS }} seconds."
497+
"text":":watch: *Duration:* ${{ steps.workflow_duration.outputs.MINUTES }} min and ${{ steps.workflow_duration.outputs.SECONDS }} sec."
496498
}
497499
},
498500
]

0 commit comments

Comments
 (0)