Skip to content

Kroxylicious junit extension development version 0.10.0 #21

Kroxylicious junit extension development version 0.10.0

Kroxylicious junit extension development version 0.10.0 #21

#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Kroxylicious Robot Command Dispatcher
on:
issue_comment:
types: [created]
jobs:
process-command:
runs-on: ubuntu-latest
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body, '@kroxylicious-robot') }}
steps:
- name: 'Check out repository'
uses: actions/checkout@v4
with:
token: ${{ secrets.KROXYLICIOUS_RELEASE_TOKEN }}
- name: 'Check team membership'
if: ${{ github.repository == 'kroxylicious/kroxylicious-junit5-extension' }}
uses: tspascoal/get-user-teams-membership@v3
id: team-membership
with:
username: ${{ github.actor }}
team: release-engineers
GITHUB_TOKEN: ${{ secrets.KROXYLICIOUS_RELEASE_TOKEN }}
- name: 'Stop workflow if user is not a team member'
if: ${{ github.repository == 'kroxylicious/kroxylicious-junit5-extension' && steps.team-membership.outputs.isTeamMember == 'false' }}
env:
GH_TOKEN: ${{ secrets.KROXYLICIOUS_RELEASE_TOKEN }}
run: |
gh issue comment ${{ github.event.issue.number }} --body "${{ github.actor }} is not entitled to use @kroxylicious-robot. The user must be a member of https://github.com/orgs/kroxylicious/teams/Developer)"
exit -1
- name: 'Extract command'
run: |
COMMAND=$(echo "${{ github.event.comment.body }}" | awk '/^@kroxylicious-robot/ {print $2}')
echo "COMMAND=${COMMAND}" >> $GITHUB_ENV
case "${COMMAND}" in
promote-release | drop-release)
;;
*)
echo "UNRECOGNIZED=true" >> $GITHUB_ENV
;;
esac
outputs:
command: ${{ env.COMMAND }}
unrecognized: ${{ env.UNRECOGNIZED }}
dispatch-release-or-drop:
needs: process-command
if: ${{ needs.process-command.outputs.command == 'drop-release' || needs.process-command.outputs.command == 'promote-release' }}
uses: ./.github/workflows/promote_release.yaml
with:
command: ${{ needs.process-command.outputs.command }}
release-pr-issue-number: ${{ github.event.issue.number }}
secrets: inherit
dispatch-help:
runs-on: ubuntu-latest
needs: process-command
if: ${{ needs.process-command.outputs.unrecognized == 'true' }}
steps:
- name: 'Check out repository'
uses: actions/checkout@v4
with:
token: ${{ secrets.KROXYLICIOUS_RELEASE_TOKEN }}
- name: 'Send help'
env:
GH_TOKEN: ${{ secrets.KROXYLICIOUS_RELEASE_TOKEN }}
run: |
gh issue comment ${{ github.event.issue.number }} --body "Sorry, I don't understand the command '${{ needs.process-command.outputs.command }}'."