Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix extracting of org from org/repo name in workflow generating docs #44

Merged
merged 1 commit into from
Jun 20, 2023

Conversation

michalinacienciala
Copy link
Collaborator

Previously we've used dest_org=${${{ inputs.destinationRepo }}%%/*} which was removing the longest part (separated by /) from the input. This wasn't what we wanted in cases where the org name is longer than the repo name. We're now changing the approach and we're using dest_org=$(echo ${{ inputs.destinationRepo }} | cut -d'/' -f1) command now. The cut command is used to extract sections from lines of files or strings. In this case, we're using it to split the ${{ inputs.destinationRepo }} string on the / delimiter and then selecting the first field (-f1) before the delimiter. By using this approach, it doesn't matter if the first or second part is longer; it will always extract the first part of the variable containing /.

Previously we've used `dest_org=${${{ inputs.destinationRepo }}%%/*}` which was
removing the longest part (separated by `/`) from the input. This wasn't what we
wanted in cases where the org name is longer than the repo name.
We're now changing the approach and we're using `dest_org=$(echo
${{ inputs.destinationRepo }} | cut -d'/' -f1)` command now. The `cut` command
is used to extract sections from lines of files or strings. In this case, we're
using it to split the ${{ inputs.destinationRepo }} string on the `/` delimiter
and then selecting the first field (`-f1`) before the delimiter.
By using this approach, it doesn't matter if the first or second part is longer;
it will always extract the first part of the variable containing `/`.
@pdyraga pdyraga merged commit e9834bd into main Jun 20, 2023
2 checks passed
@pdyraga pdyraga deleted the fix-workflow-generating-docs branch June 20, 2023 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants