|
11 | 11 | type: string
|
12 | 12 | description: "Path to a file that will be passed as --breakage-allowlist-path to swift package diagnose-api-breaking-changes"
|
13 | 13 | 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: "" |
14 | 18 | api_breakage_check_container_image:
|
15 | 19 | type: string
|
16 | 20 | description: "Container image for the API breakage check job. Defaults to latest Swift Ubuntu image."
|
@@ -95,19 +99,28 @@ jobs:
|
95 | 99 | with:
|
96 | 100 | persist-credentials: false
|
97 | 101 | submodules: true
|
| 102 | + fetch-tags: true |
| 103 | + fetch-depth: 0 # Fetching tags requires fetch-depth: 0 (https://github.com/actions/checkout/issues/1471) |
98 | 104 | - name: Mark the workspace as safe
|
99 | 105 | # https://github.com/actions/checkout/issues/766
|
100 | 106 | run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
|
101 | 107 | - name: Pre-build
|
102 | 108 | if: ${{ inputs.linux_pre_build_command }}
|
103 | 109 | run: ${{ inputs.linux_pre_build_command }}
|
104 | 110 | - name: Run API breakage check
|
| 111 | + shell: bash |
105 | 112 | 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" |
107 | 120 | 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" |
109 | 122 | 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 }}' |
111 | 124 | fi
|
112 | 125 |
|
113 | 126 | docs-check:
|
|
0 commit comments