Skip to content

Commit 40c6b00

Browse files
authored
Merge pull request #104 from ahoppen/api-breakage-baseline
Allow specifying a tag that should be used as a baseline for API breakage checks
2 parents 5627e22 + a1c1c1f commit 40c6b00

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

.github/workflows/soundness.yml

Lines changed: 16 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."
@@ -95,19 +99,28 @@ jobs:
9599
with:
96100
persist-credentials: false
97101
submodules: true
102+
fetch-tags: true
103+
fetch-depth: 0 # Fetching tags requires fetch-depth: 0 (https://github.com/actions/checkout/issues/1471)
98104
- name: Mark the workspace as safe
99105
# https://github.com/actions/checkout/issues/766
100106
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
101107
- name: Pre-build
102108
if: ${{ inputs.linux_pre_build_command }}
103109
run: ${{ inputs.linux_pre_build_command }}
104110
- name: Run API breakage check
111+
shell: bash
105112
run: |
106-
git fetch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} ${GITHUB_BASE_REF}:pull-base-ref
113+
if [[ -z '${{ inputs.api_breakage_check_baseline }}' ]]; then
114+
git fetch ${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY} ${GITHUB_BASE_REF}:pull-base-ref
115+
BASELINE_REF='pull-base-ref'
116+
else
117+
BASELINE_REF='${{ inputs.api_breakage_check_baseline }}'
118+
fi
119+
echo "Using baseline: $BASELINE_REF"
107120
if [[ -z '${{ inputs.api_breakage_check_allowlist_path }}' ]]; then
108-
swift package diagnose-api-breaking-changes pull-base-ref
121+
swift package diagnose-api-breaking-changes "$BASELINE_REF"
109122
else
110-
swift package diagnose-api-breaking-changes pull-base-ref --breakage-allowlist-path '${{ inputs.api_breakage_check_allowlist_path }}'
123+
swift package diagnose-api-breaking-changes "$BASELINE_REF" --breakage-allowlist-path '${{ inputs.api_breakage_check_allowlist_path }}'
111124
fi
112125
113126
docs-check:

0 commit comments

Comments
 (0)