Skip to content

Commit 7cad0b7

Browse files
authored
Merge pull request #16 from advanced-security/fix-github-actions
Document GitHub Actions support / Add rust support
2 parents 5368c64 + a95d2a1 commit 7cad0b7

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.github/workflows/*.yml linguist-detectable -linguist-vendored
2+
.github/workflows/*.yaml linguist-detectable -linguist-vendored

CONTRIBUTING.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Versioning and Releases
2+
3+
## Keeping roll up version tags up to date
4+
5+
Move the dynamic version identifier (ex: `v1`) to match the current SHA. This allows users to adopt a major version number (e.g. `v1`) in their workflows while automatically getting all the minor/patch updates.
6+
7+
To do this just checkout `main` given the latest version, force-create a new annotated tag, and push it:
8+
9+
```
10+
git tag -fa v1 -m "Updating v1 to 1.2.2"
11+
git push origin v1 --force
12+
```

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,19 @@ Example:
9494
9595
```
9696

97+
### Actions support
98+
99+
The GitHub API for [List repository languages](https://docs.github.com/en/rest/repos/repos?apiVersion=2022-11-28#list-repository-languages) does not by default include "YAML"/"GitHub Actions". This is particularly useful if your repository contains GitHub Actions workflows that you want to include in CodeQL analysis.
100+
101+
To add support for this to your repo, you must add a `.gitattributes` file with the following contents:
102+
103+
```
104+
.github/workflows/*.yml linguist-detectable -linguist-vendored
105+
.github/workflows/*.yaml linguist-detectable -linguist-vendored
106+
```
107+
108+
These directives tell GitHub's linguist to detect YAML files in the `.github/workflows/` directory as a language and not treat them as vendored code, making them visible in the repository languages API.
109+
97110
### Swift support
98111
If you want to include Swift in your CodeQL analysis, you need to ensure that the action runs on a macOS runner. This is because Swift analysis with CodeQL requires a macOS environment. You can achieve this by making the `runs-on` field in your workflow conditional based on the language being analyzed.
99112

@@ -123,6 +136,8 @@ This project is licensed under the terms of the MIT open source license. Please
123136

124137
Take a look at [CODEOWNERS](./CODEOWNERS.md) to identify the maintainers.
125138

139+
Contributions are welcome! If you have an idea for a new feature or improvement, please open an issue or submit a pull request. Maintainers should use the [Contributing Guide](./CONTRIBUTING.md) to control version updates.
140+
126141
## Support
127142

128143
Got a question or issue? Open an issue in this repo and tag any of the folks in [CODEOWNERS](./CODEOWNERS.md).

main.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
token = sys.argv[1]
77
endpoint = sys.argv[2]
88
exclude = sys.argv[3]
9-
codeql_languages = ["actions", "cpp", "csharp", "go", "java", "javascript", "python", "ruby", "typescript", "kotlin", "swift"]
9+
codeql_languages = ["actions", "cpp", "csharp", "go", "java", "javascript", "python", "ruby", "rust", "typescript", "kotlin", "swift"]
1010

1111

1212
# Connect to the languages API and return languages
@@ -29,11 +29,11 @@ def build_languages_list(languages):
2929
languages[i] = ("javascript")
3030
if languages[i] == "kotlin":
3131
languages[i] = ("java")
32-
# GitHub Actions
3332
if languages[i] == "yaml":
3433
languages[i] = ("actions")
35-
34+
print("After mapping:", languages)
3635
intersection = list(set(languages) & set(codeql_languages))
36+
print("Intersection:", intersection)
3737
return intersection
3838

3939
# return a list of objects from language list if they are not in the exclude list

0 commit comments

Comments
 (0)