fix: fix working directory issue (DCD-5103) - #418
Conversation
|
🤖 Hi @LukasKuzavas, I've received your request, and I'm working on it now! You can track my progress in the logs for more details. |
There was a problem hiding this comment.
This Pull Request addresses the working directory resolution issue for SonarCloud analysis (DCD-5103) by cleanly decoupling the working-directory and server-path inputs. This resolves potential failures caused by redundant ././ prefixed directory paths when running under certain configurations. The proposed refactoring improves modularity, readability, and overall pipeline robustness.
🔍 General Feedback
- Clean Decoupling: Excellent work separating
working-directoryandserver-pathparameters inbuild-gradle-g8.ymlandsonarcloud.ymlto prevent duplicate directory prefixes. - Improved Documentation: The addition of a detailed parameter description for
server-pathinsonarcloud.ymlprovides valuable clarity for workflow users. - Syntax Standards: Standardized newline formatting at the end of
.github/workflows/sonarcloud.ymlis a nice compliance touch.
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.GPR_READ_TOKEN }} | ||
| SONAR_ARTIFACT_NAME: sonar-inputs-${{ github.run_id }} | ||
| SERVER_DIR: ${{ inputs.working-directory == '.' && inputs.server-path || format('{0}/{1}', inputs.working-directory, inputs.server-path) }} |
There was a problem hiding this comment.
If inputs.working-directory is passed as an empty string, the expression currently falls back to format('{0}/{1}', '', 'server') which evaluates to /server (an absolute path pointing to root instead of a relative project path). Checking for empty strings and ./ will prevent this edge-case failure.
| SERVER_DIR: ${{ inputs.working-directory == '.' && inputs.server-path || format('{0}/{1}', inputs.working-directory, inputs.server-path) }} | |
| SERVER_DIR: ${{ (inputs.working-directory == '.' || inputs.working-directory == '' || inputs.working-directory == './') && inputs.server-path || format('{0}/{1}', inputs.working-directory, inputs.server-path) }} |
https://genesisglobal.atlassian.net/browse/DCD-5103
fix issue of sonarcloud analysis failing due to working directory resolved as with starting ././ which causes action to fail
https://github.com/genesislcap/pbi/actions/runs/30079369539?pr=2592