From 60bc04e222481df53530d881e2eebba0c8fcd0e9 Mon Sep 17 00:00:00 2001 From: Alessandro Domanico Date: Tue, 29 Oct 2024 11:38:14 +0100 Subject: [PATCH] workflow: get fork and branch upon pull_request and push events (#489) * Try to get pull-requests branches from fork * Fix fetch from origin * Debug remote and branch names * Fix no-single-branch * Adjust commit history depth * Clean workflow * Adjust openapi workflow * Add further checks and debug * Apply to openapi workflow * Update oh.yaml --- .github/workflows/maven.yml | 33 +- .github/workflows/openapi.yml | 33 +- openapi/oh.yaml | 817 +++++++++++++++++----------------- 3 files changed, 472 insertions(+), 411 deletions(-) diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index 01cc068d..76abb68e 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -15,11 +15,40 @@ jobs: steps: - uses: actions/checkout@v4 + - name: Debug GitHub variables + run: | + echo "GITHUB_EVENT_NAME: ${GITHUB_EVENT_NAME}" + echo "GITHUB_HEAD_REPOSITORY: ${GITHUB_HEAD_REPOSITORY}" + echo "GITHUB_HEAD_REF: ${GITHUB_HEAD_REF}" + echo "GITHUB_REPOSITORY: ${GITHUB_REPOSITORY}" + echo "GITHUB_REF: ${GITHUB_REF}" + echo "GITHUB_ACTOR: ${GITHUB_ACTOR}" + - name: Determine PR source branch and fork repository id: vars run: | - echo "BRANCH_NAME=${GITHUB_HEAD_REF:-develop}" >> $GITHUB_ENV - echo "FORK_REPO=${GITHUB_HEAD_REPOSITORY:-informatici/openhospital-core}" >> $GITHUB_ENV + # Get branch name from either pull_request or push context + if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then + # Get branch and fork repo for PR events + echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV + echo "FORK_REPO=${GITHUB_HEAD_REPOSITORY:-informatici/openhospital-core}" >> $GITHUB_ENV + elif [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then + # Get branch name for push events + echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV + + # Default FORK_REPO to main repository, with option to fallback if the fork exists + OWNER=${GITHUB_ACTOR} + if curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/${OWNER}/openhospital-core/branches/${GITHUB_REF##*/}" | grep -q "200"; then + echo "FORK_REPO=${OWNER}/openhospital-core" >> $GITHUB_ENV + else + echo "FORK_REPO=informatici/openhospital-core" >> $GITHUB_ENV + fi + fi + + - name: Log variables + run: | + echo "FORK_REPO: ${{ env.FORK_REPO }}" + echo "BRANCH_NAME: ${{ env.BRANCH_NAME }}" - name: Set up JDK 17 uses: actions/setup-java@v4 diff --git a/.github/workflows/openapi.yml b/.github/workflows/openapi.yml index 9a8f524e..8790404c 100644 --- a/.github/workflows/openapi.yml +++ b/.github/workflows/openapi.yml @@ -17,11 +17,40 @@ jobs: with: persist-credentials: false + - name: Debug GitHub variables + run: | + echo "GITHUB_EVENT_NAME: ${GITHUB_EVENT_NAME}" + echo "GITHUB_HEAD_REPOSITORY: ${GITHUB_HEAD_REPOSITORY}" + echo "GITHUB_HEAD_REF: ${GITHUB_HEAD_REF}" + echo "GITHUB_REPOSITORY: ${GITHUB_REPOSITORY}" + echo "GITHUB_REF: ${GITHUB_REF}" + echo "GITHUB_ACTOR: ${GITHUB_ACTOR}" + - name: Determine PR source branch and fork repository id: vars run: | - echo "BRANCH_NAME=${GITHUB_HEAD_REF:-develop}" >> $GITHUB_ENV - echo "FORK_REPO=${GITHUB_HEAD_REPOSITORY:-informatici/openhospital-core}" >> $GITHUB_ENV + # Get branch name from either pull_request or push context + if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then + # Get branch and fork repo for PR events + echo "BRANCH_NAME=${GITHUB_HEAD_REF}" >> $GITHUB_ENV + echo "FORK_REPO=${GITHUB_HEAD_REPOSITORY:-informatici/openhospital-core}" >> $GITHUB_ENV + elif [[ "${GITHUB_EVENT_NAME}" == "push" ]]; then + # Get branch name for push events + echo "BRANCH_NAME=${GITHUB_REF##*/}" >> $GITHUB_ENV + + # Default FORK_REPO to main repository, with option to fallback if the fork exists + OWNER=${GITHUB_ACTOR} + if curl -s -o /dev/null -w "%{http_code}" "https://api.github.com/repos/${OWNER}/openhospital-core/branches/${GITHUB_REF##*/}" | grep -q "200"; then + echo "FORK_REPO=${OWNER}/openhospital-core" >> $GITHUB_ENV + else + echo "FORK_REPO=informatici/openhospital-core" >> $GITHUB_ENV + fi + fi + + - name: Log variables + run: | + echo "FORK_REPO: ${{ env.FORK_REPO }}" + echo "BRANCH_NAME: ${{ env.BRANCH_NAME }}" - name: Set up JDK 17 uses: actions/setup-java@v4 diff --git a/openapi/oh.yaml b/openapi/oh.yaml index ae741708..40afbffe 100644 --- a/openapi/oh.yaml +++ b/openapi/oh.yaml @@ -6235,13 +6235,13 @@ components: description: lock format: int32 example: 0 - pharmacy: + opd: type: boolean male: type: boolean female: type: boolean - opd: + pharmacy: type: boolean PatientDTO: required: @@ -8082,6 +8082,163 @@ components: transparency: type: integer format: int32 + clipBounds: + type: object + properties: + x: + type: number + format: double + "y": + type: number + format: double + width: + type: number + format: double + height: + type: number + format: double + empty: + type: boolean + location: + type: object + properties: + x: + type: number + format: double + "y": + type: number + format: double + size: + type: object + properties: + width: + type: number + format: double + height: + type: number + format: double + bounds2D: + type: object + properties: + empty: + type: boolean + width: + type: number + format: double + height: + type: number + format: double + maxX: + type: number + format: double + maxY: + type: number + format: double + centerX: + type: number + format: double + centerY: + type: number + format: double + minX: + type: number + format: double + minY: + type: number + format: double + "y": + type: number + format: double + x: + type: number + format: double + rect: + type: object + properties: + empty: + type: boolean + width: + type: number + format: double + height: + type: number + format: double + maxX: + type: number + format: double + maxY: + type: number + format: double + centerX: + type: number + format: double + centerY: + type: number + format: double + minX: + type: number + format: double + minY: + type: number + format: double + "y": + type: number + format: double + x: + type: number + format: double + writeOnly: true + maxX: + type: number + format: double + maxY: + type: number + format: double + centerX: + type: number + format: double + centerY: + type: number + format: double + minX: + type: number + format: double + minY: + type: number + format: double + xormode: + type: object + properties: + red: + type: integer + format: int32 + green: + type: integer + format: int32 + blue: + type: integer + format: int32 + alpha: + type: integer + format: int32 + colorSpace: + type: object + properties: + type: + type: integer + format: int32 + numComponents: + type: integer + format: int32 + cs_sRGB: + type: boolean + rgb: + type: integer + format: int32 + transparency: + type: integer + format: int32 + writeOnly: true font: type: object properties: @@ -8101,8 +8258,6 @@ components: type: string plain: type: boolean - fontName: - type: string transform: type: object properties: @@ -8140,6 +8295,8 @@ components: determinant: type: number format: double + fontName: + type: string bold: type: boolean italic: @@ -8164,394 +8321,71 @@ components: type: array items: type: object - fontMetrics: + clip: type: object properties: - font: + bounds: type: object properties: - name: - type: string - style: - type: integer - format: int32 + x: + type: number + format: double + "y": + type: number + format: double + width: + type: number + format: double + height: + type: number + format: double + empty: + type: boolean + location: + type: object + properties: + x: + type: number + format: double + "y": + type: number + format: double size: - type: integer - format: int32 - attributes: type: object - additionalProperties: - type: object - family: - type: string - plain: - type: boolean - fontName: - type: string - transform: + properties: + width: + type: number + format: double + height: + type: number + format: double + bounds2D: type: object properties: - scaleX: + empty: + type: boolean + width: type: number format: double - shearY: + height: type: number format: double - shearX: + maxX: type: number format: double - scaleY: + maxY: type: number format: double - translateX: + centerX: type: number format: double - translateY: + centerY: type: number format: double - type: - type: integer - format: int32 - identity: - type: boolean - toRotation: + minX: type: number format: double - writeOnly: true - toQuadrantRotation: - type: integer - format: int32 - writeOnly: true - determinant: - type: number - format: double - bold: - type: boolean - italic: - type: boolean - numGlyphs: - type: integer - format: int32 - missingGlyphCode: - type: integer - format: int32 - italicAngle: - type: number - format: float - transformed: - type: boolean - psname: - type: string - size2D: - type: number - format: float - availableAttributes: - type: array - items: - type: object - height: - type: integer - format: int32 - ascent: - type: integer - format: int32 - descent: - type: integer - format: int32 - leading: - type: integer - format: int32 - maxDescent: - type: integer - format: int32 - widths: - type: array - items: - type: integer - format: int32 - fontRenderContext: - type: object - properties: - transform: - type: object - properties: - scaleX: - type: number - format: double - shearY: - type: number - format: double - shearX: - type: number - format: double - scaleY: - type: number - format: double - translateX: - type: number - format: double - translateY: - type: number - format: double - type: - type: integer - format: int32 - identity: - type: boolean - toRotation: - type: number - format: double - writeOnly: true - toQuadrantRotation: - type: integer - format: int32 - writeOnly: true - determinant: - type: number - format: double - antiAliasingHint: - type: object - fractionalMetricsHint: - type: object - transformed: - type: boolean - antiAliased: - type: boolean - transformType: - type: integer - format: int32 - maxAscent: - type: integer - format: int32 - maxDecent: - type: integer - format: int32 - deprecated: true - maxAdvance: - type: integer - format: int32 - clipBounds: - type: object - properties: - x: - type: number - format: double - "y": - type: number - format: double - width: - type: number - format: double - height: - type: number - format: double - empty: - type: boolean - location: - type: object - properties: - x: - type: number - format: double - "y": - type: number - format: double - size: - type: object - properties: - width: - type: number - format: double - height: - type: number - format: double - bounds2D: - type: object - properties: - empty: - type: boolean - minX: - type: number - format: double - minY: - type: number - format: double - width: - type: number - format: double - height: - type: number - format: double - maxX: - type: number - format: double - maxY: - type: number - format: double - centerX: - type: number - format: double - centerY: - type: number - format: double - "y": - type: number - format: double - x: - type: number - format: double - rect: - type: object - properties: - empty: - type: boolean - minX: - type: number - format: double - minY: - type: number - format: double - width: - type: number - format: double - height: - type: number - format: double - maxX: - type: number - format: double - maxY: - type: number - format: double - centerX: - type: number - format: double - centerY: - type: number - format: double - "y": - type: number - format: double - x: - type: number - format: double - writeOnly: true - minX: - type: number - format: double - minY: - type: number - format: double - maxX: - type: number - format: double - maxY: - type: number - format: double - centerX: - type: number - format: double - centerY: - type: number - format: double - xormode: - type: object - properties: - red: - type: integer - format: int32 - green: - type: integer - format: int32 - blue: - type: integer - format: int32 - alpha: - type: integer - format: int32 - colorSpace: - type: object - properties: - type: - type: integer - format: int32 - numComponents: - type: integer - format: int32 - cs_sRGB: - type: boolean - rgb: - type: integer - format: int32 - transparency: - type: integer - format: int32 - writeOnly: true - clip: - type: object - properties: - bounds: - type: object - properties: - x: - type: number - format: double - "y": - type: number - format: double - width: - type: number - format: double - height: - type: number - format: double - empty: - type: boolean - location: - type: object - properties: - x: - type: number - format: double - "y": - type: number - format: double - size: - type: object - properties: - width: - type: number - format: double - height: - type: number - format: double - bounds2D: - type: object - properties: - empty: - type: boolean - minX: - type: number - format: double - minY: - type: number - format: double - width: - type: number - format: double - height: - type: number - format: double - maxX: - type: number - format: double - maxY: - type: number - format: double - centerX: - type: number - format: double - centerY: + minY: type: number format: double "y": @@ -8565,12 +8399,6 @@ components: properties: empty: type: boolean - minX: - type: number - format: double - minY: - type: number - format: double width: type: number format: double @@ -8589,6 +8417,12 @@ components: centerY: type: number format: double + minX: + type: number + format: double + minY: + type: number + format: double "y": type: number format: double @@ -8596,12 +8430,6 @@ components: type: number format: double writeOnly: true - minX: - type: number - format: double - minY: - type: number - format: double maxX: type: number format: double @@ -8614,17 +8442,17 @@ components: centerY: type: number format: double - bounds2D: - type: object - properties: - empty: - type: boolean minX: type: number format: double minY: type: number format: double + bounds2D: + type: object + properties: + empty: + type: boolean width: type: number format: double @@ -8643,6 +8471,12 @@ components: centerY: type: number format: double + minX: + type: number + format: double + minY: + type: number + format: double "y": type: number format: double @@ -8689,12 +8523,6 @@ components: properties: empty: type: boolean - minX: - type: number - format: double - minY: - type: number - format: double width: type: number format: double @@ -8713,6 +8541,12 @@ components: centerY: type: number format: double + minX: + type: number + format: double + minY: + type: number + format: double "y": type: number format: double @@ -8724,12 +8558,6 @@ components: properties: empty: type: boolean - minX: - type: number - format: double - minY: - type: number - format: double width: type: number format: double @@ -8748,6 +8576,12 @@ components: centerY: type: number format: double + minX: + type: number + format: double + minY: + type: number + format: double "y": type: number format: double @@ -8755,12 +8589,6 @@ components: type: number format: double writeOnly: true - minX: - type: number - format: double - minY: - type: number - format: double maxX: type: number format: double @@ -8773,7 +8601,179 @@ components: centerY: type: number format: double + minX: + type: number + format: double + minY: + type: number + format: double deprecated: true + fontMetrics: + type: object + properties: + font: + type: object + properties: + name: + type: string + style: + type: integer + format: int32 + size: + type: integer + format: int32 + attributes: + type: object + additionalProperties: + type: object + family: + type: string + plain: + type: boolean + transform: + type: object + properties: + scaleX: + type: number + format: double + shearY: + type: number + format: double + shearX: + type: number + format: double + scaleY: + type: number + format: double + translateX: + type: number + format: double + translateY: + type: number + format: double + type: + type: integer + format: int32 + identity: + type: boolean + toRotation: + type: number + format: double + writeOnly: true + toQuadrantRotation: + type: integer + format: int32 + writeOnly: true + determinant: + type: number + format: double + fontName: + type: string + bold: + type: boolean + italic: + type: boolean + numGlyphs: + type: integer + format: int32 + missingGlyphCode: + type: integer + format: int32 + italicAngle: + type: number + format: float + transformed: + type: boolean + psname: + type: string + size2D: + type: number + format: float + availableAttributes: + type: array + items: + type: object + height: + type: integer + format: int32 + ascent: + type: integer + format: int32 + descent: + type: integer + format: int32 + leading: + type: integer + format: int32 + maxDescent: + type: integer + format: int32 + widths: + type: array + items: + type: integer + format: int32 + fontRenderContext: + type: object + properties: + antiAliased: + type: boolean + transformType: + type: integer + format: int32 + transform: + type: object + properties: + scaleX: + type: number + format: double + shearY: + type: number + format: double + shearX: + type: number + format: double + scaleY: + type: number + format: double + translateX: + type: number + format: double + translateY: + type: number + format: double + type: + type: integer + format: int32 + identity: + type: boolean + toRotation: + type: number + format: double + writeOnly: true + toQuadrantRotation: + type: integer + format: int32 + writeOnly: true + determinant: + type: number + format: double + antiAliasingHint: + type: object + fractionalMetricsHint: + type: object + transformed: + type: boolean + maxAscent: + type: integer + format: int32 + maxDecent: + type: integer + format: int32 + deprecated: true + maxAdvance: + type: integer + format: int32 TherapyRow: required: - endDate @@ -8838,10 +8838,10 @@ components: medical: type: integer format: int32 - sms: - type: boolean notify: type: boolean + sms: + type: boolean TherapyDTO: type: object properties: @@ -9187,6 +9187,9 @@ components: type: string currency: type: string + lock: + type: integer + format: int32 description: The price list PageInfoDTO: type: object