Skip to content

Commit b9a23dd

Browse files
committed
Allow specifying a tag that should be used as a baseline for API breakage checks
1 parent 79ebcef commit b9a23dd

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

.github/workflows/soundness.yml

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@ on:
1111
type: string
1212
description: "Path to a file that will be passed as --breakage-allowlist-path to swift package diagnose-api-breaking-changes"
1313
default: ""
14+
api_breakage_check_baseline:
15+
type: string
16+
description: "The tag against which API breakages that should be used as the baseline for the API breakage check. By default the PR base is used."
17+
default: ""
1418
api_breakage_check_container_image:
1519
type: string
1620
description: "Container image for the API breakage check job. Defaults to latest Swift Ubuntu image."
@@ -102,12 +106,19 @@ jobs:
102106
if: ${{ inputs.linux_pre_build_command }}
103107
run: ${{ inputs.linux_pre_build_command }}
104108
- name: Run API breakage check
109+
shell: bash
105110
run: |
106-
git fetch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} ${GITHUB_BASE_REF}:pull-base-ref
111+
if [[ -z '${{ inputs.api_breakage_check_baseline }}' ]]; then
112+
git fetch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} ${GITHUB_BASE_REF}:pull-base-ref
113+
BASELINE_REF='pull-base-ref'
114+
else
115+
BASELINE_REF='${{ inputs.api_breakage_check_baseline }}'
116+
fi
117+
echo "Using baseline: $BASELINE_REF"
107118
if [[ -z '${{ inputs.api_breakage_check_allowlist_path }}' ]]; then
108-
swift package diagnose-api-breaking-changes pull-base-ref
119+
swift package diagnose-api-breaking-changes "$BASELINE_REF"
109120
else
110-
swift package diagnose-api-breaking-changes pull-base-ref --breakage-allowlist-path '${{ inputs.api_breakage_check_allowlist_path }}'
121+
swift package diagnose-api-breaking-changes "$BASELINE_REF" --breakage-allowlist-path '${{ inputs.api_breakage_check_allowlist_path }}'
111122
fi
112123
113124
docs-check:

0 commit comments

Comments
 (0)