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

feat(actions): getActionPath() #12721

Merged
merged 9 commits into from
Dec 18, 2024
Merged

feat(actions): getActionPath() #12721

merged 9 commits into from
Dec 18, 2024

Conversation

florian-lefebvre
Copy link
Member

@florian-lefebvre florian-lefebvre commented Dec 11, 2024

Changes

  • Adds a new getActionPath() helper

Testing

Adds a test case

Docs

Changeset and withastro/docs#10353

Copy link

changeset-bot bot commented Dec 11, 2024

🦋 Changeset detected

Latest commit: a71b0e5

The changes in this PR will be included in the next version bump.

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions github-actions bot added pkg: astro Related to the core `astro` package (scope) semver: minor Change triggers a `minor` release labels Dec 11, 2024
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR is blocked because it contains a minor changeset. A reviewer will merge this at the next release if approved.

Copy link

codspeed-hq bot commented Dec 11, 2024

CodSpeed Performance Report

Merging #12721 will not alter performance

Comparing feat/get-action-path (a71b0e5) with main (a581c15)

Summary

✅ 4 untouched benchmarks

@ematipico ematipico added this to the 5.1.0 milestone Dec 12, 2024
Copy link
Member

@ematipico ematipico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@florian-lefebvre
Copy link
Member Author

The name of the actual function will probably change after docs feedback

Comment on lines +16 to +24
await fetch(getActionPath(actions.like), {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer YOUR_TOKEN'
},
body: JSON.stringify({ id: 'YOUR_ID' }),
keepalive: true
})
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for adding this! I think it's definitely worth noting that actions do not return plain JSON. They return values that are parsable by the devalue library. I suggest using the deserializeActionResult() utility from astro:actions for this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good call thank you!

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @bholmesdev -- is showing using deserializeActionResult() in this context concise? I realized we only have a short API reference sentence for this (no example usage), and no example using this anywhere in docs. (So, I'm not sure if this can be shown quickly or not.)

This would be a great addition to the actual docs (where I don't really care if it's concise or not), and if it's easy to do here, would also be a great place to put it!

Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changeset review for docs! Great work, @florian-lefebvre !

.changeset/wise-boxes-develop.md Outdated Show resolved Hide resolved
.changeset/wise-boxes-develop.md Outdated Show resolved Hide resolved
.changeset/wise-boxes-develop.md Show resolved Hide resolved
Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
Copy link
Member

@sarah11918 sarah11918 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One comment left for @florian-lefebvre as an optional type of improvement, but non-blocking and approving for docs!

Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
@ematipico ematipico merged commit c9d5110 into main Dec 18, 2024
16 checks passed
@ematipico ematipico deleted the feat/get-action-path branch December 18, 2024 14:37
@astrobot-houston astrobot-houston mentioned this pull request Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
pkg: astro Related to the core `astro` package (scope) semver: minor Change triggers a `minor` release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants