You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add / Update the codeql.yml file in a repository via a PR
29
+
30
+
Usage:
31
+
add-files code-scanning [flags]
32
+
33
+
Flags:
34
+
-c, --csv string specify the location of csv file
35
+
-f, --force force enable code scanning advanced setup or update the existing code scanning workflow file
36
+
-h, --help helpfor code-scanning
37
+
-l, --log string specify the path where the log file will be saved (default "gh-add-files.log")
38
+
-o, --organization string specify Organisation to implement code scanning
39
+
-t, --template string specify the path to the code scanning workflow template file
40
+
-w, --workflow string specify the path to the code scanning workflow file
28
41
```
29
-
The following flags are mandatory:
30
-
-`-o` - specifies the organisation you want to roll out code scanning to
31
-
-`-w` - specify the path to the code scanning file
32
-
-`-l` - specify the path where the log file will be saved
33
42
34
-
This command operates by traversing all the repositories within the organization. For each repository, it performs the following steps:
43
+
The code-scanning command accepts the following three input sources:
44
+
45
+
-`c` - A CSV file containing a list of repositories to enable code scanning for. The CSV file's format is straightforward, consisting of a single column where each row specifies a repository in the format `{OWNER}/{REPO}`. No heading is required for this csv. You can refer to the examples/test.csv file in this repository for an illustration.
46
+
-`o` - An organization to enable code scanning for. This will enable code scanning for all repositories within the organization.
47
+
- standard input - A space separated list of repositories to enable code scanning for.
35
48
36
-
1. Creates a new branch, naming it gh-cli/codescanningworkflow, branching off the default branch.
49
+
You cannot specify more than one of these input sources.
37
50
38
-
2. Commits the workflow file specified by the user using the `-w` flag.
51
+
#### codeql.yml
39
52
40
-
3. Initiates a pull request to the default branch.
53
+
There are two ways to push a `codeql.yml` file to your repository:
41
54
42
-
In case of any errors during this process, it logs the error but continues to the next repository.
55
+
- You can specify the path to a `codeql.yml` file using the `-w` flag. This file will be pushed to the repository as is.
56
+
- You can specify the path to a `codeql.yml` template file using the `-t` flag. This template file will be used to generate a `codeql.yml` file, which will then be pushed to the repository. The template file is used if you want to dynamically generate a `codeql.yml` where the default branch will be different for every repo. The tool will determine the default branch for the repository and update the template file for the repository.
43
57
44
-
After the command completes its execution, it is strongly recommended to review the log file for any potential errors. Once any identified issues are rectified, you can rerun the command.
58
+
#### Force Flag
45
59
46
-
### Code Scanning Enable Repository
60
+
The `-f` flag allows you to force enable code scanning advanced setup or update the existing code scanning workflow file. If default setup is currently enabled or if advanced setup is already enabled in the repository, this flag will disable default setup. If advanced setup is already enabled, this flag will open a PR to update the file. repository.
47
61
48
-
You have the option to incorporate a code scanning workflow file into multiple repositories within an organization, as defined by a CSV file. The CSV file's format is straightforward, consisting of a single column where each row specifies a repository in the format `{OWNER}/{REPO}`. No heading is required for this csv. You can refer to the examples/test.csv file in this repository for an illustration.
62
+
#### Usage Examples
49
63
50
-
You can run the following command:
64
+
To enable code scanning for all repositories within an organization, run the following command:
-`-o` - specifies the organisation you want to roll out code scanning to
56
-
-`-w` - specify the path to the code scanning file
57
-
-`-l` - specify the path where the log file will be saved
58
-
-`-c` - specify the location of the csv file
59
-
60
68
61
-
This command operates by traversing all the repositories specified in the csv within the organization. For each repository, it performs the following steps:
62
-
63
-
1. Creates a new branch, naming it gh-cli/codescanningworkflow, branching off the default branch.
64
-
65
-
2. Commits the workflow file specified by the user using the `-w` flag.
66
-
67
-
3. Initiates a pull request to the default branch.
69
+
To enable code scanning for a list of repositories specified in a CSV file, run the following command:
After the command completes its execution, it is strongly recommended to review the log file for any potential errors. Once any identified issues are rectified, you can rerun the command.
79
+
To enable code scanning for all repositories within an organization using a template file, run the following command:
0 commit comments