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

Add cppcheck github workflow #207

Closed
wants to merge 1 commit into from
Closed

Conversation

bhundven
Copy link
Contributor

@bhundven bhundven commented Nov 19, 2022

This workflow will require a project token added to GITHUB_TOKEN name in the project settings:

https://docs.github.com/en/codespaces/managing-codespaces-for-your-organization/managing-encrypted-secrets-for-your-repository-and-organization-for-github-codespaces#adding-secrets-for-a-repository

This will allow the cppcheck report to be attached to the run of the action.

Signed-off-by: Bryan Hundven [email protected]

@bhundven bhundven force-pushed the add_cppcheck branch 4 times, most recently from 03de145 to 225e96b Compare November 20, 2022 19:01
@vmatare
Copy link
Owner

vmatare commented Dec 2, 2022

I'm dying to see the results, but what token and where do I get it? The job isn't giving me an error message either...

@bhundven
Copy link
Contributor Author

bhundven commented Dec 4, 2022

@bhundven bhundven force-pushed the add_cppcheck branch 2 times, most recently from 61556e7 to 5b33844 Compare December 6, 2022 20:45
@bhundven
Copy link
Contributor Author

bhundven commented Dec 6, 2022

As the documentation says, I think you just have to setup permissions to allow actions to use the secrets.GITHUB_TOKEN. I've never set this up myself, so I'm not really sure.

I made a minor update to fix a small spacing issue and to remove a default comment. I also update the branch with latest origin/master.

@vmatare
Copy link
Owner

vmatare commented Dec 16, 2022

From https://docs.github.com/en/actions/security-guides/automatic-token-authentication#about-the-github_token-secret:

At the start of each workflow run, GitHub automatically creates a unique GITHUB_TOKEN secret to use in your workflow. You can use the GITHUB_TOKEN to authenticate in a workflow run.

So the token should already be there. Under Settings->Actions->General the Workflow Permissions are set to Read and Write. I'm thinking I should even knock that down to readonly, because my actions don't need to write to the repo. No idea what other permissions I could give.

Anyways, the cppcheck action seems to fail, but without an error message I consider it kinda bugged :-P

@bhundven
Copy link
Contributor Author

Again, I have never used the token, so I'm not sure. But this seems to be a bit more detailed:
https://dev.to/github/the-githubtoken-in-github-actions-how-it-works-change-permissions-customizations-3cgp

@bhundven
Copy link
Contributor Author

Been working with GHA for a bit, and secrets.GITHUB_TOKEN is a "built-in" secret for the repository/organization.

This workflow will require a project token added to GITHUB_TOKEN name
in the project settings:

https://docs.github.com/en/codespaces/managing-codespaces-for-your-organization/managing-encrypted-secrets-for-your-repository-and-organization-for-github-codespaces#adding-secrets-for-a-repository

This will allow the cppcheck report to be attached to the run of the
action.

Signed-off-by: Bryan Hundven <[email protected]>
@bhundven
Copy link
Contributor Author

To be honest, I really wanted this to work, but I've seen other people having issues with this specific action, so I'm going to give up for now. I'll see if I can find another action that does the right thing.

@bhundven bhundven closed this Mar 11, 2024
@bhundven bhundven deleted the add_cppcheck branch March 11, 2024 19:37
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 this pull request may close these issues.

2 participants