[MISC] Utilise Probot for PR commentary (#633)

Remove Buildkite trigger for commentary.
This commit is contained in:
Amir Zarrinkafsh 2020-02-14 18:50:38 +11:00 committed by GitHub
parent 4643e488db
commit 6530780817
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 11 deletions

View File

@ -14,17 +14,6 @@ if [[ $BUILDKITE_LABEL =~ ":docker: Deploy" ]]; then
docker logout
fi
if [[ $BUILDKITE_LABEL == ":docker: Deploy Manifests" ]] && [[ $BUILDKITE_PULL_REQUEST != "false" ]]; then
if [[ ! $(curl -fs --retry 3 "https://api.github.com/repos/authelia/authelia/issues/${BUILDKITE_PULL_REQUEST}/comments" | jq '.[].user.login') =~ autheliabot ]]; then
echo "--- :github: Add deployment commentary"
if [[ $BUILDKITE_PULL_REQUEST_REPO == "git://github.com/authelia/authelia.git" ]]; then
curl -fs --retry 3 -H "Authorization: token ${GITHUB_COMMENT_TOKEN}" -X "POST" -d "{\"body\": \"# Docker Container\nThese changes are published for testing at the following location:\n* \`docker pull authelia/authelia:${BUILDKITE_BRANCH}\`\"}" "https://api.github.com/repos/authelia/authelia/issues/${BUILDKITE_PULL_REQUEST}/comments"
else
curl -fs --retry 3 -H "Authorization: token ${GITHUB_COMMENT_TOKEN}" -X "POST" -d "{\"body\": \"# Docker Container\nThese changes are published for testing at the following location:\n* \`docker pull authelia/authelia:PR${BUILDKITE_PULL_REQUEST}\`\"}" "https://api.github.com/repos/authelia/authelia/issues/${BUILDKITE_PULL_REQUEST}/comments"
fi
fi
fi
if [[ $BUILDKITE_LABEL == ":docker: Deploy Manifests" ]] && [[ $BUILDKITE_BRANCH == "master" ]] && [[ $BUILDKITE_PULL_REQUEST == "false" ]]; then
echo "--- :docker: Removing tags for deleted branches"
anontoken=$(curl -fsL --retry 3 'https://auth.docker.io/token?service=registry.docker.io&scope=repository:authelia/authelia:pull' | jq -r .token)

19
.github/probot.js vendored Normal file
View File

@ -0,0 +1,19 @@
// PR commentary for Authelia branch based contributions
on('pull_request.opened')
.filter(
context =>
context.payload.pull_request.head.label.slice(0, 9) === 'authelia:'
)
.comment(`# Docker Container
These changes are published for testing at the following location:
* \`docker pull authelia/authelia:{{ pull_request.head.ref }}\``)
// PR commentary for third party based contributions
on('pull_request.opened')
.filter(
context =>
context.payload.pull_request.head.label.slice(0, 9) !== 'authelia:'
)
.comment(`# Docker Container
These changes once approved by a team member will be published for testing at the following location:
* \`docker pull authelia/authelia:PR{{ pull_request.number }}\``)