@@ -24,9 +24,9 @@ this in the workflow file:
24
24
env: …
25
25
26
26
You can use the following environment variables to configure the script:
27
- - GITHUB_WORKFLOW : The name of the Workflow (default: CI)
28
- - GITHUB_WORKFLOW_REF : The ref path to the workflow to use instead of GITHUB_WORKFLOW (optional)
29
- - GITHUB_BASE_REF : The base branch to compare the coverage results against (default: main)
27
+ - GITHUB_BASELINE_WORKFLOW : The name of the GitHub actions Workflow that produces the baseline coverage (default: CI)
28
+ - GITHUB_BASELINE_WORKFLOW_REF : The ref path to the workflow to use instead of GITHUB_BASELINE_WORKFLOW (optional)
29
+ - TARGET_BRANCH : The base branch to compare the coverage results against (default: main)
30
30
- COVERAGE_ARTIFACT_NAME: The name of the artifact containing the code coverage results (default: code-coverage)
31
31
- COVERAGE_FILE_NAME: The name of the file containing the code coverage results (default: coverage.txt)
32
32
- CHANGED_FILES_PATH: The path to the file containing the list of changed files (default: .github/outputs/all_modified_files.json)
44
44
GITHUB_REPOSITORY=$1
45
45
GITHUB_PULL_REQUEST_NUMBER=$2
46
46
GITHUB_RUN_ID=$3
47
- GITHUB_WORKFLOW =${GITHUB_WORKFLOW :- CI}
48
- TARGET_BRANCH=${GITHUB_BASE_REF :- main}
47
+ GITHUB_BASELINE_WORKFLOW =${GITHUB_BASELINE_WORKFLOW :- CI}
48
+ TARGET_BRANCH=${TARGET_BRANCH :- main}
49
49
COVERAGE_ARTIFACT_NAME=${COVERAGE_ARTIFACT_NAME:- code-coverage}
50
50
COVERAGE_FILE_NAME=${COVERAGE_FILE_NAME:- coverage.txt}
51
51
@@ -75,9 +75,9 @@ if [[ -z ${GITHUB_OUTPUT+x} ]]; then
75
75
exit 1
76
76
fi
77
77
78
- # If GITHUB_WORKFLOW_REF is defined, extract the workflow file path from it and use it instead of GITHUB_WORKFLOW
79
- if [[ -n ${GITHUB_WORKFLOW_REF +x} ]]; then
80
- GITHUB_WORKFLOW =$( basename " ${GITHUB_WORKFLOW_REF %%@* } " )
78
+ # If GITHUB_BASELINE_WORKFLOW_REF is defined, extract the workflow file path from it and use it instead of GITHUB_BASELINE_WORKFLOW
79
+ if [[ -n ${GITHUB_BASELINE_WORKFLOW_REF +x} ]]; then
80
+ GITHUB_BASELINE_WORKFLOW =$( basename " ${GITHUB_BASELINE_WORKFLOW_REF %%@* } " )
81
81
fi
82
82
83
83
export GH_REPO=" $GITHUB_REPOSITORY "
@@ -99,7 +99,7 @@ rm -r "/tmp/gh-run-download-$GITHUB_RUN_ID"
99
99
end_group
100
100
101
101
start_group " Download code coverage results from target branch"
102
- LAST_SUCCESSFUL_RUN_ID=$( gh run list --status=success --branch=" $TARGET_BRANCH " --workflow=" $GITHUB_WORKFLOW " --event=push --json=databaseId --limit=1 -q ' .[] | .databaseId' )
102
+ LAST_SUCCESSFUL_RUN_ID=$( gh run list --status=success --branch=" $TARGET_BRANCH " --workflow=" $GITHUB_BASELINE_WORKFLOW " --event=push --json=databaseId --limit=1 -q ' .[] | .databaseId' )
103
103
if [ -z " $LAST_SUCCESSFUL_RUN_ID " ]; then
104
104
echo " ::error::No successful run found on the target branch"
105
105
exit 1
0 commit comments