@@ -6,15 +6,45 @@ inputs:
6
6
description : ' Run attempt number'
7
7
required : true
8
8
9
+ outputs :
10
+ tests_to_run :
11
+ description : ' Modified tests to run based on rerun logic'
12
+
9
13
runs :
10
14
using : ' composite'
11
15
steps :
12
- - name : Check if this is a re-run
16
+ - name : Check if this is a re-run and modify tests_to_run
13
17
shell : bash
14
18
run : |
19
+ tests_to_run="all" # Default value
20
+
15
21
if [ "${{ inputs.run_attempt }}" -gt 1 ]; then
16
22
echo "This run is a re-run (attempt #${{ inputs.run_attempt }})."
23
+
24
+ # Fetch Run Details from GitHub API
25
+ curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
26
+ -H "Accept: application/vnd.github.v3+json" \
27
+ "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}" > run_details.json
28
+
29
+ # Ensure jq is installed, install if necessary
30
+ if ! command -v jq &> /dev/null; then
31
+ echo "jq not found, installing..."
32
+ sudo apt-get update && sudo apt-get install -y jq
33
+ fi
34
+
35
+ # Extract triggering actor using jq
36
+ triggering_actor=$(jq -r '.triggering_actor.login' run_details.json)
37
+
38
+ echo "Triggering Actor: $triggering_actor"
39
+
40
+ if [[ "$triggering_actor" == "gha-bstack-rerun[bot]" ]]; then
41
+ echo "The run was triggered by the GitHub App."
42
+ tests_to_run="rerun_tests" # Set custom value if triggered by GitHub App
43
+ else
44
+ echo "The run was triggered by: $triggering_actor"
45
+ fi
17
46
else
18
47
echo "This is the first run."
19
48
fi
20
49
50
+ echo "tests_to_run=${tests_to_run}" >> $GITHUB_OUTPUT
0 commit comments