feat: Add automated PRs and matrix notifications

This commit is contained in:
Benjamin Bädorf 2021-06-14 21:39:29 +02:00
parent e7091e1de1
commit 5648262cb5
No known key found for this signature in database
GPG key ID: 4406E80E13CD656C

View file

@ -3,8 +3,33 @@ type: docker
name: api
steps:
- name: "Sync upstream and try PR"
- name: "Sync upstream to local"
image: nixery.dev/git/shell
environment:
GITEA_SSH_KEY:
from_secret: gitea_ssh_key
commands:
- echo $GITEA_SSH_KEY > ~/.ssh/id_rsa
- echo <<EOF
Host git.b12f.io
Port 2222
User git
HostName git.b12f.io
EOF >> ~/.ssh/config
- git clone -b devos git@git.b12f.io:pub-solar/os
- cd os
- git remote add devos https://github.com/divnix/devos.git
- git fetch --all
- git merge -X theirs devos/core
- git push origin devos
- name: "Sync core with upstream"
image: nixery.dev/git/tea/shell
when:
status:
- success
depends_on:
- "Sync upstream to local"
environment:
GITEA_SSH_KEY:
from_secret: gitea_ssh_key
@ -18,7 +43,52 @@ steps:
EOF >> ~/.ssh/config
- git clone -b core git@git.b12f.io:pub-solar/os
- cd os
- git remote add devos https://github.com/divnix/devos.git
- git fetch --all
- git merge devos/core
- git fetch
- git merge devos
- git push origin core
- name: "Notify Success"
image: plugins/matrix
when:
status:
- success
depends_on:
- "Sync core with upstream"
settings:
homeserver: https://element.pub.solar
roomid: operations:pub.solar
username:
from_secret: matrix_username
password:
from_secret: matrix_password
template: Upstreaming devos into core succeeded.
- name: "Open pull request for failed merge"
image: nixery.dev/tea/shell
when:
status:
- failure
depends_on:
- "Sync core with upstream"
environment:
TEA_CONFIG:
from_secret: tea_config
commands:
- echo $TEA_CONFIG > ~/.config/tea/config.yml
- tea pulls create --base core --head devos
- name: notify
image: plugins/matrix
when:
status:
- success
depends_on:
- "Open pull request for failed merge"
settings:
homeserver: https://element.pub.solar
roomid: operations:pub.solar
username:
from_secret: matrix_username
password:
from_secret: matrix_password
template: Upstreaming devos into core failed. A pull request has been created https://git.b12f.io/pub-solar/os/pulls