-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Feature/api docs workflow #7948
Conversation
GITHUB_EMAIL: ${{ vars.GH_EMAIL }} | ||
GITHUB_USER: ${{ vars.GH_USER }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know we use the AWS Secrets Manager action in some other workflows and so is there a reason we're using the github environment variables here?
I think in the past we've used the github variables and workflows would fail because they were unable to access these variables, like in a fork PR. I know this is supposed to be ran from a dispatch-event though so maybe we wouldn't run into that issue
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I think when you use these variables, they aren't escaped in the workflow. Can you confirm?
- name: Create new branch | ||
run: | | ||
git checkout -b ${{ env.BRANCH_NAME }} | ||
curl -L -o ${{ vars.REF_LOC }} ${{ vars.REMOTE_REF }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question here, should we be saving these variables in the github environment variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also what does vars.REF_LOC
and vars.REMOTE_REF
represent? We can chat offline about it
|
||
# Set branch name to be used as environment variable | ||
- name: Set Branch Name | ||
run: echo "BRANCH_NAME=$(echo $(date +%s))" >> $GITHUB_ENV |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not blocking: do you think it would be helpful to have these branches start with update-ref-{date here}
?
tasks/clean-references.mjs
Outdated
const cleanReferences = {}; | ||
const categoryNodes = []; | ||
|
||
const categories = Object.values(API_CATEGORIES).concat( | ||
Object.values(API_SUB_CATEGORIES) | ||
); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not blocking: I think if we move these consts closer to where it was being used, it would be easier for others to understand how they are being used maybe?
tasks/clean-references.mjs
Outdated
categories.forEach((catName) => { | ||
const catNode = references.categories.filter((cat) => { | ||
return cat.name === catName; | ||
})[0]; | ||
|
||
if (catNode) { | ||
categoryNodes.push(catNode); | ||
recursivelyPopulateNodes(catNode); | ||
} | ||
}); | ||
|
||
cleanReferences['categories'] = categoryNodes; | ||
|
||
try { | ||
writeFileSync( | ||
'src/references/references.json', | ||
JSON.stringify(cleanReferences, null, 2), | ||
'utf8' | ||
); | ||
console.log('Data successfully saved to disk'); | ||
} catch (error) { | ||
console.log('An error has occurred ', error); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we add some comments here about what this code is doing? I think it would be helpful for anyone needing to look at this code to understand what's going on
* initial template implementation * additional template functionality * update modal * add api references json * add api categories * update to template and display * revert changes to dev script * pass references to components * remove build cache * remove pass through references * clean references * add categories into clean references * update references * update references with correct categories * update references * cleaned references * update to clean references * update header and Toc * update directories * update generate directory * add sub categories * move references and rename to raw-references * update api docs template * undo unwanted changes * remove colons, some type updates, add keys (#7952) * update TypeLink to output a button (#7953) * chore(api-docs-template): Update ApiModal styling/markup. Move breadcrumbs to ApiModalBreadcrumbs (#7956) * update Modal styling/ add Breadcrumbs * remove commented out code * update to generateDirectory to add api reference pages (#7950) Co-authored-by: Jacob Logan <lognjc@amazon.com> * add getApiStaticPath util function (#7949) * add getApiStaticPath util function * add typing * update type and comment on paths --------- Co-authored-by: Jacob Logan <lognjc@amazon.com> * parse out markdown links in comments * update link to display literal type * Feature/api docs workflow (#7948) * update api disapatch workflow * set github commit user in workflow * update references file name * rename raw and clean references * update workflow add comments to clean script --------- Co-authored-by: Jacob Logan <lognjc@amazon.com> * add dark mode to modal description text * update api function returns to use typeParameters * remove space in promise display * close modal when click outside modal (#7969) Co-authored-by: katiegoines <katiegoines@gmail.com> * focus modal on open (#7970) Co-authored-by: katiegoines <katiegoines@gmail.com> * fix typo; * fix error in modal close * format "Returns" as code (#7971) * . * format Returns as code --------- Co-authored-by: katiegoines <katiegoines@gmail.com> * add api link legend * update breadcrumbs separator, render nested typeArgs, render nested arraytypes * add function type display * add error type * update api legend and link colors * update cleaned references location * update base references files * update scroll behavior * reverting uneeded changes to base.scss * update formatting * add spacing to breadcrumbs * remove extra space and add legend header * add formatting to api comments (#8000) Co-authored-by: Jacob Logan <lognjc@amazon.com> * update list parsing --------- Co-authored-by: Jacob Logan <lognjc@amazon.com> Co-authored-by: Heather Buchel <hbuchel@gmail.com> Co-authored-by: Katie Goines <30757403+katiegoines@users.noreply.github.com> Co-authored-by: katiegoines <katiegoines@gmail.com>
Description of changes:
Workflow for the api docs migration
Related GitHub issue #, if available:
Instructions
If this PR should not be merged upon approval for any reason, please submit as a DRAFT
Which product(s) are affected by this PR (if applicable)?
Which platform(s) are affected by this PR (if applicable)?
Please add the product(s)/platform(s) affected to the PR title
Checks
Does this PR conform to the styleguide?
Does this PR include filetypes other than markdown or images? Please add or update unit tests accordingly.
Are any files being deleted with this PR? If so, have the needed redirects been created?
Are all links in MDX files using the MDX link syntax rather than HTML link syntax?
ref: MDX:
[link](https://docs.amplify.aws/)
HTML:
<a href="https://docs.amplify.aws/">link</a>
When this PR is ready to merge, please check the box below
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.