-
Notifications
You must be signed in to change notification settings - Fork 3
86 lines (75 loc) · 3.04 KB
/
default_completed.yml
File metadata and controls
86 lines (75 loc) · 3.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: Default (completed)
on:
workflow_run:
workflows: ['Default', 'Release']
types:
- completed
jobs:
context:
runs-on: ubuntu-latest
outputs:
emoji: ${{ steps.ref.outputs.emoji }}
actor: ${{ steps.ref.outputs.actor }}
event: ${{ steps.ref.outputs.event }}
env: ${{ steps.ref.outputs.env }}
conclusion: ${{ steps.ref.outputs.conclusion }}
ref: ${{ steps.ref.outputs.ref }}
ref_link: ${{ steps.ref.outputs.ref_link }}
workflow_id: ${{ steps.ref.outputs.workflow_id }}
workflow_url: ${{ steps.ref.outputs.workflow_url }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/context
- id: ref
shell: bash
run: |
branch="${{ github.event.workflow_run.head_branch }}"
title="${{ github.event.workflow_run.display_title }}"
sha="${{ github.event.workflow_run.head_sha }}"
workflow_id="${{ github.event.workflow_run.id }}"
workflow_url="${{ github.event.workflow_run.html_url}}"
actor="${{ github.event.workflow_run.triggering_actor.login }}"
conclusion="${{ github.event.workflow_run.conclusion }}"
commit_short=$(echo "$sha" | cut -c1-7)
ref="$branch ($commit_short) $title"
event="${{ github.event.workflow_run.event}}"
repo_url="${{ github.server_url }}/${{ github.repository }}"
if [[ "$event" == "push" ]]; then
env="dev"
ref_link="$repo_url/commit/$sha"
elif [[ "$event" == "release" ]]; then
env="production"
ref_link="$repo_url/releases/tag/$branch"
fi
if [[ "$conclusion" == "success" ]]; then
emoji=":white_check_mark:"
else
emoji=":x:"
fi
echo "emoji=$emoji" >> $GITHUB_OUTPUT
echo "actor=$actor" >> $GITHUB_OUTPUT
echo "event=$event" >> $GITHUB_OUTPUT
echo "conclusion=$conclusion" >> $GITHUB_OUTPUT
echo "env=$env" >> $GITHUB_OUTPUT
echo "ref=$ref" >> $GITHUB_OUTPUT
echo "ref_link=$ref_link" >> $GITHUB_OUTPUT
echo "workflow_id=$workflow_id" >> $GITHUB_OUTPUT
echo "workflow_url=$workflow_url" >> $GITHUB_OUTPUT
cat $GITHUB_OUTPUT
slack_notification:
needs: context
runs-on: ubuntu-latest
steps:
- uses: mozilla/addons/.github/actions/slack-workflow-notification@main
with:
slack_token: ${{ secrets.SLACK_TOKEN }}
slack_channel: ${{ secrets.SLACK_ADDONS_PRODUCTION_CHANNEL }}
emoji: ${{ needs.context.outputs.emoji }}
actor: ${{ needs.context.outputs.actor }}
event: ${{ needs.context.outputs.event }}
conclusion: ${{ needs.context.outputs.conclusion }}
env: ${{ needs.context.outputs.env }}
ref: ${{ needs.context.outputs.ref }}
ref_link: ${{ needs.context.outputs.ref_link }}
workflow_id: ${{ needs.context.outputs.workflow_id }}
workflow_url: ${{ needs.context.outputs.workflow_url }}