@@ -2,50 +2,43 @@ name: 'setup-rerun-vars'
2
2
description : ' Setup BrowserStack Rerun Variables'
3
3
4
4
inputs :
5
- run_attempt :
6
- description : ' Run attempt number'
7
- required : true
8
5
repository :
9
6
description : ' GitHub context - Repository'
10
7
required : true
11
8
run_id :
12
9
description : ' GitHub context - Run_ID'
13
10
required : true
14
11
github_token :
15
- description : ' GitHub Token'
12
+ description : ' GitHub Token for authentication '
16
13
required : true
17
14
18
- outputs :
19
- tests_to_run :
20
- description : ' Modified tests to run based on rerun logic'
21
15
22
16
runs :
23
17
using : ' composite'
24
18
steps :
25
- - name : Check if this is a re-run
19
+ - name : Set environment variables required for re-run, to be used by SDK
26
20
shell : bash
27
21
run : |
28
22
# Assign inputs to variables
29
23
run_id="${{ inputs.run_id }}"
30
24
repository="${{ inputs.repository }}"
31
25
github_token="${{ inputs.github_token }}"
32
- run_attempt="${{ inputs.run_attempt }}"
26
+
27
+ # Get the triggering actor
28
+ curl -H "Authorization: token $github_token" \
29
+ -H "Accept: application/vnd.github.v3+json" \
30
+ "https://api.github.com/repos/$repository/actions/runs/$run_id" > run_details.json
31
+ triggering_actor=$(jq -r '.triggering_actor.login' run_details.json)
32
+ echo "Triggering Actor: $triggering_actor"
33
+
34
+ # Check if BrowserStack has triggered the re-run
35
+ if [[ "$triggering_actor" == "bstack-trigger[bot]" ]]; then
36
+ echo "The run was triggered by the GitHub App."
33
37
34
- if [ "$run_attempt" -gt 1 ]; then
35
- echo "This run is a re-run (attempt #${run_attempt})."
36
- curl -H "Authorization: token $github_token" \
37
- -H "Accept: application/vnd.github.v3+json" \
38
- "https://api.github.com/repos/$repository/actions/runs/$run_id" > run_details.json
39
- triggering_actor=$(jq -r '.triggering_actor.login' run_details.json)
40
- echo "Triggering Actor: $triggering_actor"
41
- if [[ "$triggering_actor" == "gha-bstack-rerun[bot]" ]]; then
42
- echo "The run was triggered by the GitHub App."
43
- echo "tests_to_run=rerun_tests" >> $GITHUB_ENV
44
- else
45
- echo "The run was triggered by: ${{ github.actor }}"
46
- echo "tests_to_run=all_tests" >> $GITHUB_ENV
47
- fi
48
- else
49
- echo "This is the first run."
50
- echo "tests_to_run=all_tests" >> $GITHUB_ENV
38
+ # TODO - Call BrowserStack API to get the values of the 2 environment values
39
+
40
+ # Set the environment variables
41
+ echo "BSTACK_IS_RERUN=true" >> $GITHUB_ENV
42
+ echo "BSTACK_RERUN_TESTS=test1" >> $GITHUB_ENV
51
43
fi
44
+
0 commit comments