-
Notifications
You must be signed in to change notification settings - Fork 495
51 lines (48 loc) · 1.61 KB
/
MERGE_MAIN_TO_DEVELOP.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
name: MERGE_MAIN_TO_DEVELOP
on:
push:
branches:
- "main"
jobs:
merge_main_to_develop:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout develop
uses: actions/checkout@v4
with:
ref: develop
fetch-depth: 0
- name: Merge main to develop and push
run: |
git config user.name github-actions
git config user.email [email protected]
git merge -m 'chore: merge main to develop' --no-edit origin/main
git push
post_failure:
name: Notify failure
needs: merge_main_to_develop
if: failure()
runs-on: ubuntu-latest
steps:
- name: Import Secrets
id: secrets
uses: hashicorp/[email protected]
with:
url: ${{ secrets.VAULT_ADDR }}
method: approle
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
exportEnv: false
secrets: |
secret/data/products/desktop-modeler/ci/slack_integration SLACK_CHANNEL_ID;
secret/data/products/desktop-modeler/ci/slack_integration SLACK_BOT_TOKEN;
- name: Notify on Slack if merge fails
uses: slackapi/slack-github-action@v2
with:
method: chat.postMessage
token: ${{ steps.secrets.outputs.SLACK_BOT_TOKEN }}
payload: |
channel: ${{ steps.secrets.outputs.SLACK_CHANNEL_ID }}
text: "Automatic merge of <https://github.com/${{ github.repository }}/tree/${{ github.ref }}|${{ github.ref }}> to <https://github.com/${{ github.repository }}/tree/develop|${{ github.repository }}#develop> failed."