Skip to content

Commit

Permalink
ci: add debug-with-ssh-only-jobs-matching
Browse files Browse the repository at this point in the history
  • Loading branch information
sebthom committed Sep 6, 2024
1 parent e3886a5 commit 5cb7352
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ on:
description: "Limit access to the SSH session to the GitHub user that triggered the job."
default: true
type: boolean
debug-with-ssh-only-jobs-matching:
description: "Only start an SSH session for jobs matching this regex pattern:"
default: ".*"
type: string


defaults:
Expand Down Expand Up @@ -217,10 +221,15 @@ jobs:
if: always()
run: |
set -eu
job_filter_pattern="${{ inputs.debug-with-ssh-only-jobs-matching }}"
echo "job_filter: $job_filter_pattern"
job_info=$(echo "$GITHUB_JOB ${{ runner.os }} java-${{ matrix.java }}" | tr -d '\n')
echo "job_info: $job_info"
when="${{ inputs.debug-with-ssh }}"
if [[ $when == "always" ]] || case "${{ job.status }}" in
if [[ $when == "always" ]] || [[ "$job_info" =~ .*$job_filter_pattern.* ]] && case "${{ job.status }}" in
success) [[ $when == "always" ]] ;;
cancelled) [[ $when == "on_failure_or_cancelled" ]] ;;
failure) [[ $when == "on_failure"* ]] ;;
Expand Down

0 comments on commit 5cb7352

Please sign in to comment.