-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EN-23320 - Adding Teams action in reusable workflows
- Loading branch information
1 parent
56f038e
commit a796f74
Showing
2 changed files
with
29 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,10 +66,19 @@ on: | |
description: Additional PR comment content aside from workflow run and next version. | ||
required: false | ||
type: string | ||
send-teams-notification: | ||
description: Flag indicating whether to send a notification to the team's channel. Expected `true` or `false`. | ||
required: false | ||
type: boolean | ||
default: true | ||
custom-facts-for-team-channel: | ||
description: The custom facts that will be included in the post in the team's channel. By default Workflow, Run, Actor and Version are included. | ||
required: false | ||
type: string | ||
custom-action-for-team-channel: | ||
description: The custom action that will be included in the post in the team's channel. | ||
required: false | ||
type: string | ||
ms-teams-uri: | ||
description: The URI for the teams channel where a status will be posted. Either this value or the secret MS_TEAMS_URI must be provided. This input is the preferred way to provide the URI but the secret should be used instead if the value is defined as a secret. | ||
required: false | ||
|
@@ -117,7 +126,9 @@ jobs: | |
printInput('is-merge-to-main', '${{ inputs.is-merge-to-main }}'); | ||
printInput('timezone', '${{ inputs.timezone }}'); | ||
printInput('ms-teams-uri', '${{ inputs.ms-teams-uri }}'); | ||
printInput('send-teams-notification', '${{ inputs.send-teams-notification }}'); | ||
printInput('custom-facts-for-team-channel', process.env.FACTS, true); | ||
printInput('custom-action-for-team-channel', process.env.ACTION, true); | ||
printInput('additional-pr-comment-content', process.env.ADDITIONAL_CONTENT, true); | ||
printInput('additional-conclusions', process.env.ADDITIONAL_CONCLUSIONS, true); | ||
core.endGroup(); | ||
|
@@ -129,6 +140,7 @@ jobs: | |
FACTS: ${{ inputs.custom-facts-for-team-channel }} | ||
ADDITIONAL_CONTENT: ${{ inputs.additional-pr-comment-content }} | ||
ADDITIONAL_CONCLUSIONS: ${{ inputs.additional-conclusions }} | ||
ACTION: ${{ inputs.custom-action-for-team-channel }} | ||
|
||
- uses: im-open/[email protected] | ||
id: conclusion | ||
|
@@ -165,7 +177,7 @@ jobs: | |
FACTS: ${{ inputs.custom-facts-for-team-channel }} | ||
|
||
- name: Send status to team's notification channel | ||
if: always() | ||
if: always() && inputs.send-teams-notification | ||
continue-on-error: true | ||
uses: im-open/[email protected] | ||
with: | ||
|
@@ -175,6 +187,7 @@ jobs: | |
teams-uri: ${{ inputs.ms-teams-uri || secrets.MS_TEAMS_URI }} | ||
timezone: ${{ inputs.timezone }} | ||
custom-facts: ${{ steps.team-channel-facts.outputs.facts }} | ||
custom-actions: ${{ inputs.custom-action-for-team-channel }} | ||
|
||
- name: Construct PR Comment | ||
id: comment | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,8 +86,16 @@ on: | |
description: The custom facts that will be included in the post in the team's channel. By default Workflow, Run, Actor and Version are included. | ||
required: false | ||
type: string | ||
custom-actions-for-team-channel: | ||
description: The custom actions that will be included in the post in the team's channel. | ||
required: false | ||
type: string | ||
custom-facts-for-deployment-notifications-channel: | ||
description: 'The custom facts that will be included in the Deployment Notifications channel. By default Actor and Version are included.' | ||
description: 'The custom facts that will be included in the Deployment Notifications channel.' | ||
required: false | ||
type: string | ||
custome-actions-for-deployment-notifications-channel: | ||
description: 'The custom actions that will be included in the post in the Deployment Notifications channel. By default the actions are 'View in TechHub' and 'View in GitHub'.' | ||
required: false | ||
type: string | ||
ms-teams-uri: | ||
|
@@ -140,15 +148,19 @@ jobs: | |
printInput('ms-teams-uri', '${{ inputs.ms-teams-uri }}'); | ||
printInput('deploy-notifications-channel', '${{ inputs.deploy-notifications-channel }}'); | ||
printInput('custom-facts-for-team-channel', process.env.CUSTOM_FACTS_TEAMS, true); | ||
printInput('custom-actions-for-team-channel', process.env.CUSTOM_ACTIONS_TEAMS, true); | ||
printInput('custom-facts-for-deployment-notifications-channel', process.env.CUSTOM_FACTS_DEPLOY, true); | ||
printInput('custom-actions-for-deployment-notifications-channel', process.env.CUSTOM_ACTIONS_DEPLOY, true); | ||
core.endGroup(); | ||
core.startGroup('Reusable workflow secrets'); | ||
printInput('MS_TEAMS_URI', '${{ secrets.MS_TEAMS_URI }}'); | ||
core.endGroup(); | ||
env: | ||
CUSTOM_FACTS_TEAMS: ${{ inputs.custom-facts-for-team-channel }} | ||
CUSTOM_ACTIONS_TEAMS: ${{ inputs.custom-actions-for-team-channel }} | ||
CUSTOM_FACTS_DEPLOY: ${{ inputs.custom-facts-for-deployment-notifications-channel }} | ||
CUSTOM_ACTIONS_DEPLOY: ${{ inputs.custom-actions-for-deployment-notifications-channel }} | ||
|
||
- uses: im-open/[email protected] | ||
id: conclusion | ||
|
@@ -207,6 +219,7 @@ jobs: | |
teams-uri: ${{ inputs.ms-teams-uri || secrets.MS_TEAMS_URI }} | ||
timezone: ${{ inputs.timezone }} | ||
custom-facts: ${{ steps.team-channel-facts.outputs.facts }} | ||
custom-actions: ${{ inputs.custom-actions-for-team-channel }} | ||
|
||
- name: Determine if a post should be made in Deployment Notifications channel | ||
if: always() | ||
|
@@ -271,3 +284,4 @@ jobs: | |
timezone: ${{ inputs.timezone }} | ||
include-default-facts: false # This cuts down on the message size for the prod room | ||
custom-facts: ${{ steps.deployment-channel-facts.outputs.facts }} | ||
custom-actions: ${{ inputs.custom-actions-for-deployment-notifications-channel }} |