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

Fix analysis check #83

Merged
merged 2 commits into from
Jul 12, 2022
Merged

Conversation

jorsmatthys
Copy link
Contributor

@jorsmatthys jorsmatthys commented Jul 12, 2022

Hello @NickLiffen

We finally got our GitHub Advanced Security licenses so we are going to start rolling out code-scanning to all repos 🎉 .
I wanted to do some final tests and noticed a bug however.

When you introduced the functionality to no longer create pull-requests for repos that already have code-scanning/analyses I did a quick test to see if it didn't create a pr anymore on a repo that was already scanned and that worked.
Today I tested on some new repo's and I found that a pr was actually never created.

I noticed that when there is no analysis available yet the GitHub Api returns

{
  "message": "no analysis found",
  "documentation_url": "https://docs.github.com/rest/reference/code-scanning#list-code-scanning-analyses-for-a-repository"
}

instead of an empty list, so data.length in this case results in undefined. Perhaps this is something that changed over time.
I only changed the condition a bit and now it seems to work (again).

Also I believe that GitHub changed something to the security model because I had to update my app permissions:

2022-07-12T13:18:49.100Z ghas:error Error: Command failed: git push --set-upstream origin ghas-BEfYw
To https://github.com/liantisit-github-automation-poc/azure-functions-medewerkerspaspoort-poc.git
! [remote rejected] ghas-BEfYw -> ghas-BEfYw (refusing to allow a GitHub App to create or update workflow .github/workflows/codeql-analysis.yml without workflows permission)
error: failed to push some refs to 'https://github.com/liantisit-github-automation-poc/azure-functions-medewerkerspaspoort-poc.git'

I updated the doc accordingly.

Kind regards,
Jors

@NickLiffen
Copy link
Owner

@jorsmatthys thank you SO MUCH for this pull request 🙇

I love this contribution! Looking back through our changes it looked like something did change, thank you for this 🙇

I will merge this PR now 💯

@NickLiffen NickLiffen self-requested a review July 12, 2022 16:54
@NickLiffen NickLiffen merged commit 10218d3 into NickLiffen:main Jul 12, 2022
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