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

HTTP error when using in github Actions mode #91

Open
reubensamuel opened this issue Dec 1, 2022 · 6 comments
Open

HTTP error when using in github Actions mode #91

reubensamuel opened this issue Dec 1, 2022 · 6 comments

Comments

@reubensamuel
Copy link

reubensamuel commented Dec 1, 2022

Hi Nick

We are using the last option with action workflow file when i run the action we get the following issue any help would be highly appreciated

Run npm run getRepos

> [email protected] getRepos
> npm run build && node ./lib/getRepos.js


> [email protected] build
> npx tsc

2022-12-01T12:42:20.944Z ghas:inform Could not find file: ./bin/organizations.json. Assuming no organizations have been collected.
2022-12-01T12:42:20.945Z ghas:inform Collecting repositories for XXXX
2022-12-01T12:42:20.945Z ghas:inform This is org number 1 of 1
2022-12-01T12:42:21.689Z ghas:error HttpError: Not Found
    at /home/runner/work/ghas-enablement/ghas-enablement/node_modules/@octokit/request/dist-node/index.js:86:21
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async getInstallationAuthentication (/home/runner/work/ghas-enablement/ghas-enablement/node_modules/@octokit/auth-app/dist-node/index.js:280:7)
    at async hook (/home/runner/work/ghas-enablement/ghas-enablement/node_modules/@octokit/auth-app/dist-node/index.js:449:7)
    at async Job.doExecute (/home/runner/work/ghas-enablement/ghas-enablement/node_modules/bottleneck/light.js:405:[18](https://github.com/HDRUK/ghas-enablement/actions/runs/3592684492/jobs/6048693035#step:4:19))

Thanks
reuben

@NickLiffen
Copy link
Owner

Hey @reubensamuel 👋

It looks like you haven't set the right environment variables 👀

The reason why I say this is due to this line:

2022-12-01T12:42:20.945Z ghas:inform Collecting repositories for XXXX

What did you set GITHUB_ORG to 🤔

@reubensamuel
Copy link
Author

reubensamuel commented Dec 5, 2022

Hi Nick , I have blurred the organisation for confidentiality but it does pick up the org name from the variable GITHUB_ORG This is org number 1 of 1 . It seems to be failing here:

const repositoriesInOrg = (await func(
    res[index].login,
    graphQuery
)) as usersWriteAdminReposArray;

res[index].repos = repositoriesInOrg;
}

Does the user below require admin access to github ?

git config --global user.name "ghas-enablement"
git config --global user.email "[email protected]"

Thanks

Reuben

@benhorgen
Copy link

I ran into a similar issue when I updated my repos.json file manually and accidentally used the full repo URL (e.g included full FQDN path prefixed with https://...) rather than just the subpath my-org/my-repo

For example I had a line like this in my 'repos.json' file:

"repo": "https://github.com/benhorgen/ghas-bootcamp-benhorgen"

when I should have had this:

"repo": "benhorgen/ghas-bootcamp-benhorgen"

Full example:

[
    {
        "login": "benhorgen",
        "repos": [
            {
                "enableDependabot": false,
                "enableDependabotUpdates": false,
                "enableSecretScanning": true,
                "enableCodeScanning": true,
                "enablePushProtection": true,
                "primaryLanguage": "python",
                "createIssue": true,
                "repo": "benhorgen/ghas-bootcamp-benhorgen"
            }
        ]
    }
]

@reubensamuel
Copy link
Author

Thanks Benhorgen, I have the right repo format too. Did you have to manually create the repos.json file ? I tried creating a repos.json file it said for public repos ghas is enabled automatically but for private repos asked to purchase enterprise. But doesn't configure code scanning on the public repo even though it was set to true :s . Also i tried with github app approach got Http error . Gave up on it getting it done through github apps Then i made use of PAT which worked but then above issues where we couldn't configure anything just enable. There are too many moving parts here maybe config of app or PAT could be added to the readme

Thanks
Reuben

@reubensamuel
Copy link
Author

In github apps configuration could not understand the difference between APP_ID: ${{ secrets.GHAS_ENABLEMENT_APP_ID }} and APP_INSTALLATION_ID: "12345678" are they different where could i find these details

@joshjohanning
Copy link
Contributor

In github apps configuration could not understand the difference between APP_ID: ${{ secrets.GHAS_ENABLEMENT_APP_ID }} and APP_INSTALLATION_ID: "12345678" are they different where could i find these details

@reubensamuel
The app id is visible when you are editing your GitHub app, such as:

image

For the installation ID, I find it easiest by going to my org's installed apps and clicking on your app. The installation ID will be in the address bar

image

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

4 participants