-
Notifications
You must be signed in to change notification settings - Fork 52
71 lines (65 loc) · 3.32 KB
/
mattermost_pull_request.yml
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
# This file is part of t8code.
# t8code is a C library to manage a collection (a forest) of multiple
# connected adaptive space-trees of general element types in parallel.
#
# Copyright (C) 2015 the developers
#
# t8code is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# t8code is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with t8code; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# This is a workflow that posts messages in our Mattermost-Team concerning pull-requests and pushes
# on the main, develop and feature-CI_mattermost_messages branch.
name: Mattermost_message_pull_request
# Controls when the workflow will run
on:
# Triggers the workflow on pull request events on the feature-CI_mattermost_messages, develop or main branch
pull_request:
branches: [ feature-CI_mattermost_messages, develop, main ]
types: [ opened, synchronize, reopened, closed]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
env:
message_build: 0
jobs:
send_mm_message_pr:
if: github.repository == 'DLR-AMR/t8code'
runs-on: ubuntu-20.04
steps:
- name: debug_before_build
run: echo ${{ env.message_build}}
# build the message depending on different types of events and event actions. Message is written into mattermost.json
- name: Merge_message
if: github.event.action == 'closed' && github.event.pull_request.merged == true
run: |
echo message_build=1 >> $GITHUB_ENV &&
echo message_content='Pull request ${{ github.event.number }} has been merged. See ${{ github.event.pull_request.html_url }} for more details.' >> $GITHUB_ENV
- name: push_message
if: github.event_name == 'push' && github.event.action != 'closed'
run: |
echo message_build=1 >> $GITHUB_ENV &&
echo message_content='${{ github.event.pusher.name }} pushed into ${{ github.event.ref }}. See ${{ github.event.compare }} for more details.' >> $GITHUB_ENV
- name: pull_request_message
if: github.event_name == 'pull_request' && github.event.action != 'synchronize' && github.event.action != 'closed'
run: |
echo message_build=1 >> $GITHUB_ENV &&
echo message_content='Pull request ${{ github.event.number }} has been ${{ github.event.action }}. See ${{ github.event.pull_request.html_url }} for more details.' >> $GITHUB_ENV
- name: debug_after_build
run: echo ${{ env.message_build }}
# if a message has been written send the message to the mattermost-channel described in the secrets
- name: send_message
if: ${{ env.message_build == 1 }}
uses: mattermost/action-mattermost-notify@master
with:
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK_URL }}
MATTERMOST_USERNAME: t8ddy
TEXT: ${{ env.message_content }}