forked from asyncapi/community
-
Notifications
You must be signed in to change notification settings - Fork 0
69 lines (67 loc) · 2.77 KB
/
update-website-tsc.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
#This action update the list of TSC members in the website repository. List of all Maintainers is later rendered in the asyncapi.com website.
name: Update list of Maintainers in the website repo
on:
push:
branches:
- "master"
paths:
- "MAINTAINERS.yaml"
jobs:
update-website:
name: Make PR on website repository with updated maintainers list
runs-on: ubuntu-latest
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
steps:
- name: Checkout Current repository
uses: actions/checkout@v2
with:
path: community
- name: Checkout Another repository
uses: actions/checkout@v2
with:
repository: asyncapi/website
path: website
token: ${{ env.GITHUB_TOKEN }}
- name: Config git
run: |
git config --global user.name asyncapi-bot
git config --global user.email [email protected]
- name: Create branch
working-directory: ./website
run: |
git checkout -b update-tscmembers-${{ github.sha }}
- name: Convert YAML to JSON using Python
working-directory: ./community
run: |
python -c 'import sys, yaml, json; json.dump(yaml.safe_load(sys.stdin), sys.stdout, indent=4)' < MAINTAINERS.yaml > MAINTAINERS.json
- name: Copy maintainers file from Current Repo to Another
working-directory: ./website
run: |
cp ../community/MAINTAINERS.json ./config/MAINTAINERS.json
- name: Check if there are changes
id: check_changes
working-directory: ./website
run: |
if ! git diff --quiet; then
git add .
git commit -m "docs(community): update latest maintainers list"
git push https://${{ env.GITHUB_TOKEN }}@github.com/asyncapi/website
echo "CHANGES=true" >> $GITHUB_OUTPUT
else
echo "No changes to commit."
echo "CHANGES=false" >> $GITHUB_OUTPUT
fi
- name: Create PR if there are changes
if: steps.check_changes.outputs.CHANGES == 'true'
working-directory: ./website
run: |
gh pr create --title "docs(community): update latest maintainers list" --body "Updated Maintainers list is available and this PR introduces changes with latest information about Maintainers" --head "update-tscmembers-${{ github.sha }}"
- name: Report workflow run status to Slack
if: failure() # Only, on failure, send a message on the slack channel
uses: rtCamp/action-slack-notify@v2
env:
SLACK_WEBHOOK: ${{ secrets.SLACK_CI_FAIL_NOTIFY }}
SLACK_TITLE: 🚨 Update maintainers list action failed 🚨
SLACK_MESSAGE: Failed to update the maintainers list in the website repository.
MSG_MINIMAL: true