Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ When a Konflux build check fails on a pull request, this action will automatical
- **Auto-Cleanup**: Removes old retest comments when new commits are pushed
- **Filtered Checks**: Only retests checks matching a specific name suffix (e.g., `-on-push`)
- **Custom Retest Command**: Configure the command used to trigger retests (default: `/retest`)
- **Disable via Label**: Add the `disable-konflux-auto-retest` label to a PR to skip automatic retesting


### Usage
Expand Down
10 changes: 9 additions & 1 deletion .github/workflows/retest-konflux-builds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ jobs:
auto-retest-failed-konflux-build:
if: |
github.event_name == 'check_run' &&
github.event.check_run.pull_requests[0] != null &&
github.event.check_run.pull_requests.length > 0 &&
github.event.check_run.conclusion == 'failure' &&
startsWith(github.event.check_run.name, 'Red Hat Konflux')
runs-on: ubuntu-latest
Expand All @@ -82,6 +82,14 @@ jobs:
RETEST_COMMAND: ${{ inputs.retest_command }}
run: |
CHECK_NAME="${{ github.event.check_run.name }}"
PR_NUMBER="${{ github.event.check_run.pull_requests[0].number }}"

# Fetch current PR labels to avoid race conditions with stale event data
CURRENT_LABELS=$(gh api "repos/${{ github.repository }}/pulls/$PR_NUMBER" --jq '.labels[].name')
if echo "$CURRENT_LABELS" | grep -q "^disable-konflux-auto-retest$"; then
echo "Skipping retest: disable-konflux-auto-retest label is present"
exit 0
fi

# Check if the check name ends with the configured suffix
if [[ ! "$CHECK_NAME" == *"$CHECK_NAME_SUFFIX" ]]; then
Expand Down