Skip to content

.github/workflows/trigger-flaky.yml #11150

.github/workflows/trigger-flaky.yml

.github/workflows/trigger-flaky.yml #11150

Workflow file for this run

on:
issue_comment:
types:
- created
jobs:
trigger_flaky:
name: Trigger flaky test runner on /flaky comment
if: |
github.event.issue.pull_request
&& contains(fromJSON('["MEMBER","OWNER"]'), github.event.comment.author_association)
&& startsWith(github.event.comment.body, '/flaky ')
runs-on: ubuntu-latest
steps:
- name: Checkout kibana-operations
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
repository: 'elastic/kibana-operations'
ref: main
path: ./kibana-operations
token: ${{secrets.KIBANAMACHINE_TOKEN}}
persist-credentials: false
- name: Trigger flaky test runner
working-directory: ./kibana-operations/triage
env:
GITHUB_TOKEN: ${{secrets.KIBANAMACHINE_TOKEN}}
BUILDKITE_TOKEN: ${{secrets.OPS_BUILDKITE_TOKEN}}
COMMENT_BODY: ${{github.event.comment.body}}
ISSUE_NUMBER: ${{github.event.issue.number}}
run: |
# Extract configs (everything after '/flaky ')
configs="${COMMENT_BODY#/flaky }"
# Validate comment body format
# Pattern: type:path[:count] where path cannot contain .., start with ./ or /, or end with /
if [[ ! "$configs" =~ ^[[:space:]]*(ftrConfig|scoutConfig|config):[a-zA-Z0-9_-]+([/.][a-zA-Z0-9_-]+)*(:[0-9]+)?([[:space:]]+(ftrConfig|scoutConfig|config):[a-zA-Z0-9_-]+([/.][a-zA-Z0-9_-]+)*(:[0-9]+)?)*[[:space:]]*$ ]]; then
echo "::error::Invalid comment format. Use: /flaky <type>:<config>[:count] [<type>:<config>[:count] ...]"
echo "::error::Where <type> is one of: ftrConfig, scoutConfig, config"
echo "::error::And <count> is an optional positive integer"
echo "::error::Path cannot contain .., start with ./ or /, or end with /"
echo "::error::Example: /flaky config:x-pack/test:5 ftrConfig:functional/apps"
exit 1
fi
npm ci --omit=dev
node trigger-flaky-test-runner $ISSUE_NUMBER "$configs"