Skip to content

Commit

Permalink
[Internal] Throw error if no notebook author (#2960)
Browse files Browse the repository at this point in the history
# Description

Please add an informative description that covers that changes made by
the pull request and link all relevant issues.

# All Promptflow Contribution checklist:
- [ ] **The pull request does not introduce [breaking changes].**
- [ ] **CHANGELOG is updated for new features, bug fixes or other
significant changes.**
- [ ] **I have read the [contribution guidelines](../CONTRIBUTING.md).**
- [ ] **Create an issue and link to the pull request to get dedicated
review from promptflow team. Learn more: [suggested
workflow](../CONTRIBUTING.md#suggested-workflow).**

## General Guidelines and Best Practices
- [ ] Title of the pull request is clear and informative.
- [ ] There are a small number of commits, each of which have an
informative message. This means that previously merged commits do not
appear in the history of the PR. For more information on cleaning up the
commits in your PR, [see this
page](https://github.com/Azure/azure-powershell/blob/master/documentation/development-docs/cleaning-up-commits.md).

### Testing Guidelines
- [ ] Pull request includes test coverage for the included changes.

Signed-off-by: Brynn Yin <[email protected]>
  • Loading branch information
brynn-code authored Apr 23, 2024
1 parent 5421aa5 commit bc1620a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions scripts/docs/doc_generation.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -142,16 +142,15 @@ function Add-Metadata{
)
if (-not $AuthorList){
# Skip insert if author list not set
Write-Host "Skip Add Metadata: $NotebookPath - Author list not set"
throw "Skip Add Metadata: $NotebookPath - Author list not set"
return
}
$NotebookContent = Get-Content $NotebookPath -Raw | ConvertFrom-Json
# Covert to System.Collections.ArrayList to avoid 'Collection was of a fixed size' error.
$NotebookContent.cells = [System.Collections.ArrayList]::new($NotebookContent.cells)
if($NotebookContent.cells[0].source.Length -gt 1){
# If the first cell length > 1, indicate there are more things than title it self in the first cell
Write-Host "Skip Add Metadata: $NotebookPath - First cell length > 1, only leave title to that cell."
Write-Host "$(NotebookContent.cells[0].source)"
throw "Skip Add Metadata: $NotebookPath - First cell length > 1, only leave title to that cell. $(NotebookContent.cells[0].source)"
return
}
$MetadataFormat = "Authored by:&nbsp;{0}{1}"
Expand Down

0 comments on commit bc1620a

Please sign in to comment.