forked from open-telemetry/opentelemetry-demo
-
Notifications
You must be signed in to change notification settings - Fork 36
55 lines (48 loc) · 1.8 KB
/
merge-upstream.yaml
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
name: Scheduled Merge Upstream
on:
workflow_dispatch:
schedule:
- cron: '23 0/3 * * *'
jobs:
merge_upstream:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: main
fetch-depth: 0
token: ${{ secrets.OTEL_DEMO_MERGE_SECRET }}
- name: fetch and push
env:
GITHUB_TOKEN: ${{ github.token }}
UPSTREAM: https://github.com/open-telemetry/opentelemetry-demo
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"
git remote add upstream "${UPSTREAM}"
# Get all recent branches and commits from the upstream
git fetch upstream main
git merge upstream/main --no-edit || { echo "Merge conflicts detected. Please resolve them manually."; exit 1; }
git push origin $(git branch --show-current)
notify-failure:
needs: [merge_upstream]
if: always() && needs.merge_upstream.result != 'success'
runs-on: ubuntu-latest
steps:
- name: Get previous workflow status
uses: Mercymeilya/[email protected]
id: last_status
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Slack notification
if: success() && steps.last_status.outputs.last_status == 'success'
env:
SLACK_WEBHOOK: ${{ secrets.OTELSLACKCHANNELWEBHOOK }}
SLACK_UNFURL_LINKS: "true"
uses: AlexanderWert/[email protected]
with:
args: |
:wave:
Auto-merge of the <${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|elastic/opentelemetry-demo> repository with the upstream failed!
Manual resolution of the merge conflicts is required!