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

Action fails when keywords are missing (overwrite-github) #6

Closed
MoltenCoffee opened this issue Apr 24, 2020 · 3 comments
Closed

Action fails when keywords are missing (overwrite-github) #6

MoltenCoffee opened this issue Apr 24, 2020 · 3 comments

Comments

@MoltenCoffee
Copy link
Contributor

Great workflow! This is exactly what I was looking for.
One thing I noticed when trying to get this working was the fact that when there is no "keywords" field in package.json, the action fails when syncing with direction: overwrite-github
Perhaps this is intentional, but maybe the error could be a bit more verbose; Right now it will say:

HttpError: Invalid request.

"names" wasn't supplied.
    at /home/runner/work/_actions/jaid/action-sync-node-meta/v1.3.1/build/index.js:6:219539
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async R.requestGithubApi (/home/runner/work/_actions/jaid/action-sync-node-meta/v1.3.1/build/index.js:6:1057831)
    at async R.applyGithubUpdate (/home/runner/work/_actions/jaid/action-sync-node-meta/v1.3.1/build/index.js:6:1058410)
    at async /home/runner/work/_actions/jaid/action-sync-node-meta/v1.3.1/build/index.js:6:1060149

I'm not sure if this is on the part of GitHub or the workflow, but perhaps an error saying the keywords/topics are missing would be clearer.
The error, for example, given when trying uppercase letters is better:
"Topics must start with a lowercase letter or number, consist of 35 characters or less, and can include hyphens."

Keep up the good work!

@Jaid Jaid closed this as completed in c3801ec Apr 29, 2020
@Jaid
Copy link
Owner

Jaid commented Apr 29, 2020

Thank you very much for the issue and sorry for the late response!

Your assumptions are correct. "names" wasn't supplied. does indeed mean that the GitHub Action tries to write undefined to the repository's topics.

Instead of improving the understandability of this error message, I decided to stick to a different behaviour:

  • If direction is overwrite-github, sync the package.json representation to the repository metadata, unless:
    • input.syncKeywords is set to "false"
    • or package.json[keywords] is not an array

In your case, not adding a keywords field to your package.json means that the second condition is given, so syncing for this single field will be automatically disabled. Description and homepage syncing will still be active as long as package.json[description] and package.json[homepage] are given.

I decided to add this behaviour because most package.jsons don't have a manually added keywords field, so throwing an error in the GitHub Action could be too frustrating.

@Jaid
Copy link
Owner

Jaid commented Apr 29, 2020

Example output with new skipping message:

2020-04-29_22-16-20

v1.4.0 is released now.

@MoltenCoffee
Copy link
Contributor Author

Seems like the most logical option to me as well. Awesome!

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

No branches or pull requests

2 participants