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

Fault Detection of 'arduino-library' topic due to bash script error #178

Closed
nkaaf opened this issue Feb 5, 2024 · 5 comments
Closed

Fault Detection of 'arduino-library' topic due to bash script error #178

nkaaf opened this issue Feb 5, 2024 · 5 comments

Comments

@nkaaf
Copy link
Contributor

nkaaf commented Feb 5, 2024

The execution of my workflow was successful, but I saw the warning
"Warning: arduino-library is not found in this repo topic. Please add this tag in the About repo". I double checked my repo topics, but "arduino-library" is in there.

In the line above the warning, there is a bash error "ci/actions_install.sh: line 40: {: command not found".

I try to find the reason for this error and request a pull request after finding out the problem.

Workflow Source: https://github.com/nkaaf/Arduino-List/blob/638a66afd49261b5cf2b9fd690d9808c05a242c2/.github/workflows/githubci.yml
Workflow execution: https://github.com/nkaaf/Arduino-List/actions/runs/7781242146/job/21215312938

@tyeth
Copy link
Contributor

tyeth commented Feb 5, 2024

@nkaaf thanks for raising this issue and tracking down the culprit.
Just playing around, and we can probably skip the temporary file with something like this if you fancy giving it a test, it seemed to detect your topics and fail gracefully with bad URLs (tested in new script using WSL/bash externally to actions_install.sh):

repo_topics=$(curl -f --request GET --url "https://api.github.com/repos/$GITHUB_REPOSITORY" || echo '{"topics":[]}')
repo_topics=$(jq -r '.topics[]' --jsonargs <<< $repo_topics )

@tyeth
Copy link
Contributor

tyeth commented Feb 5, 2024

It occurred to me we could eventually get a length issue, so maybe echoing the variable to jq in the second line is more sensible (passing as STDIN rather than command line arguments)

repo_topics=$(curl -f --request GET --url "https://api.github.com/repos/$GITHUB_REPOSITORY" || echo '{"topics":[]}')
repo_topics=$(echo $repo_topics | jq -r '.topics[]' )

@nkaaf
Copy link
Contributor Author

nkaaf commented Feb 6, 2024

I have tested your second approach too and it worked. The output of a private/non-existing repository would be the error message of curl, that 404 occurred. If you want to, you can close my PR #179 and create a new one with your solution.

@tyeth
Copy link
Contributor

tyeth commented Feb 6, 2024

I found the output visually from curl showed the 404 response json message along with usual download info, but the -f flag meant it shortcutted to instead assigning the default echo value on non 200 success code. Made me wonder about the --slient flag to stop the extra output.
Thanks for taking a look. I've got to merge in something else so may slip it in then.

@nkaaf
Copy link
Contributor Author

nkaaf commented Mar 12, 2024

Fixed in #180

@nkaaf nkaaf closed this as completed Mar 12, 2024
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 a pull request may close this issue.

2 participants