Skip to content

Commit

Permalink
handle needs
Browse files Browse the repository at this point in the history
  • Loading branch information
atchertchian committed Dec 5, 2024
1 parent 95f9bba commit 069e382
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .github/actions/send-teams-notification/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ runs:
SMALL_SHA=${GITHUB_LONG_SHA:0:6}
echo "result=$SMALL_SHA" >> $GITHUB_OUTPUT
- name: Compute needs
id: compute-needs
shell: bash
env:
NEEDS: ${{ inputs.needs }}
run: |
NEEDS_OUTPUT=$(echo $NEEDS | jq -r 'to_entries[] | "\(.key): \(.value.result)"')
echo "result=$NEEDS_OUTPUT" >> $GITHUB_OUTPUT
- name: Compute message
id: compute-message
shell: bash
Expand All @@ -68,6 +77,7 @@ runs:
PR_TITLE: ${{ github.event.pull_request.title }}
ISSUE_BODY: ${{ github.event.issue.body }}
COMMIT_MESSAGE: ${{ github.event.head_commit.message }}
NEEDS: ${{ steps.compute-needs.outputs.result }}
run: |
${{ github.action_path }}/compute-message.sh >> $GITHUB_OUTPUT
Expand Down
4 changes: 4 additions & 0 deletions .github/actions/send-teams-notification/compute-message.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ if [ -n "$BLOCK_MESSAGE" ]; then
COMPUTED_MESSAGE="${COMPUTED_MESSAGE}$BLOCK_MESSAGE"
fi

if [ -n "$NEEDS" ]; then
COMPUTED_MESSAGE="${COMPUTED_MESSAGE}\n\n$NEEDS"
fi

if [ -n "$COMPUTED_MESSAGE" ]; then
COMPUTED_MESSAGE="${COMPUTED_MESSAGE}"
COMPUTED_MESSAGE=$(printf "${COMPUTED_MESSAGE}" | sed -z 's/\n/\\n/g' | sed -r 's/"/\\\"/g' | sed -e 's/\r//g')
Expand Down

0 comments on commit 069e382

Please sign in to comment.