Repository navigation
$expand, $validate-code and :in fail when a ValueSet uses an unknown CodeSystem or CodeSystem version
#5275
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Pull Request Pipeline | |
| on: | |
| pull_request: | |
| jobs: | |
| load-config-and-run: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Install yq | |
| run: | | |
| sudo wget https://github.com/mikefarah/yq/releases/download/v4.40.5/yq_linux_amd64 -O /usr/bin/yq | |
| sudo chmod +x /usr/bin/yq | |
| - name: Load ignored modules from config | |
| id: load_config | |
| run: | | |
| IGNORED=$(yq '.ignored_modules' .github/config/ignored-modules.yml | tr -d '"') | |
| echo "ignored_modules=$IGNORED" >> $GITHUB_OUTPUT | |
| outputs: | |
| ignored_modules: ${{ steps.load_config.outputs.ignored_modules }} | |
| run-parallel-build: | |
| needs: load-config-and-run | |
| uses: ./.github/workflows/parallel-pipeline-build.yml | |
| with: | |
| ignored_modules: ${{ needs.load-config-and-run.outputs.ignored_modules }} | |
| secrets: | |
| CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
| GIT_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| # Fail the PR if a changelog entry newly added in this PR is in the wrong version directory for the | |
| # target branch (GL-8831). Only files ADDED in this PR are enforced — pre-existing entries are never | |
| # re-validated, and edits to existing entries (e.g. a typo fix in an older release dir) are allowed. | |
| changelog-location: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Validate changelog location | |
| run: | | |
| set -euo pipefail | |
| changelog_root="hapi-fhir-docs/src/main/resources/ca/uhn/hapi/fhir/changelog" | |
| git fetch --quiet origin "$GITHUB_BASE_REF" | |
| # Changelog entries newly ADDED in this PR: number-prefixed .yml/.yaml under the changelog tree. | |
| # Edits to existing entries (diff-filter M) are intentionally excluded so typo fixes in older | |
| # release dirs do not fail. | |
| mapfile -t entries < <(git diff --name-only --diff-filter=A "origin/$GITHUB_BASE_REF...HEAD" \ | |
| | grep -E "^${changelog_root}/(.*/)?[0-9][^/]*\.ya?ml$" || true) | |
| if [ "${#entries[@]}" -eq 0 ]; then | |
| echo "No changelog entries added/changed in this PR — nothing to check." | |
| exit 0 | |
| fi | |
| # Project version from the root pom (the project <version> is the first one in the file). | |
| # sed quits at the first match rather than piping to 'head -1': under 'set -o pipefail' the | |
| # pipe form fails intermittently, because head closes the pipe after one line and sed's | |
| # final flush then hits EPIPE and exits 4. | |
| pom_version=$(sed -n '/<version>.*<\/version>/{s:.*<version>\(.*\)</version>.*:\1:p;q;}' pom.xml) | |
| echo "pom version: $pom_version" | |
| # Only enforce for -SNAPSHOT versions. | |
| if [[ "$pom_version" != *-SNAPSHOT ]]; then | |
| echo "pom version is not -SNAPSHOT — skipping changelog location check." | |
| exit 0 | |
| fi | |
| base_ver="${pom_version%-SNAPSHOT}" | |
| major="${base_ver%%.*}" | |
| rest="${base_ver#*.}" | |
| minor="${rest%%.*}" | |
| if [[ "$GITHUB_BASE_REF" == "master" ]]; then | |
| expected="${changelog_root}/${major}_$((minor + 1))_0" | |
| elif [[ "$GITHUB_BASE_REF" =~ ^rel_[0-9]+_[0-9]+$ ]]; then | |
| expected="${changelog_root}/${major}_${minor}_0" | |
| else | |
| echo "Target branch '$GITHUB_BASE_REF' is not master or rel_X_Y — skipping changelog location check." | |
| exit 0 | |
| fi | |
| echo "Expected changelog directory: $expected" | |
| status=0 | |
| for f in "${entries[@]}"; do | |
| if [[ "$(dirname "$f")" != "$expected" ]]; then | |
| echo "::error file=$f::Changelog '$f' is in the wrong directory for target branch '$GITHUB_BASE_REF'. Expected it in '$expected/' (pom version '$pom_version')." | |
| status=1 | |
| fi | |
| done | |
| exit $status |