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

Some feature requests #34

Open
emilva opened this issue Mar 24, 2022 · 7 comments
Open

Some feature requests #34

emilva opened this issue Mar 24, 2022 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@emilva
Copy link

emilva commented Mar 24, 2022

Hi @NickLiffen 👋

Some feature requests to help us onboard on a per-team basis:

  1. In step one: make it possible to gather repos by team rather than language (https://docs.github.com/en/rest/reference/teams#list-team-repositories)
  2. Set the branch name in codeql-analysis.yml based on the repo's default branch name
@NickLiffen
Copy link
Owner

Thanks for the feedback @emilva 👍 I will try and get these features addressed as soon as I can 👍

@NickLiffen NickLiffen self-assigned this Mar 24, 2022
@NickLiffen NickLiffen added the enhancement New feature or request label Mar 24, 2022
@emilva
Copy link
Author

emilva commented Mar 24, 2022

Great stuff @NickLiffen!

@agonzalez-plume
Copy link
Contributor

For the default branch name, all you need to do is change the branches in the codeql-analysis.yml to say:

branches: [ $default-branch ]

When you check that file in, Github will change it to the default branch automatically

So do:

name: "CodeQL"

on:
  push:
    branches: [ $default-branch ]
  pull_request:
    branches: [ $default-branch ]

@agonzalez-plume
Copy link
Contributor

Ah, sorry the $default-branch really only works on the workflow templates, for checkins it doesn't work the same.

@NickLiffen
Copy link
Owner

Yeah the way we would do this is doing some sort of template mapping where we replace a dummy value like $placeholder with the actual value. I have a mock up working, just need to spend some time getting it ready 👍

@agonzalez-plume
Copy link
Contributor

I got it working as a quick fix using command line tools, since this little 'glitch' made me have to re-run a whole bunch of git pushes.

commands.ts, and then I modified worker.ts, commitFile.ts to send down defaultBranch to commands.ts.

    {
      command: "cp",
      args: [
        "./codeql-analysis.yml",
        `/Users/${user}/${destDir}/${tempDIR}/${repo}/.github/workflows/`,
      ],
      cwd: process.cwd(),
    },
    {
      command: "sed",
      args: [
        "-i ''",
        `s/\\$default-branch/${defaultBranch}/`,
        ".github/workflows/codeql-analysis.yml"
      ],
      cwd: `/Users/${user}/${destDir}/${tempDIR}/${repo}`,
    },

@NickLiffen
Copy link
Owner

@agonzalez-plume 🙇 this looks very nice 🙇

If you would like to touch this up and make it a bit more usable, I would love to see this in a pull request 🙇 I would be very open to including this. I don't know if it would work on Window, but on:

  • Mac
  • Linux
  • Codspaces

It would be amazing 🙇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants