Skip to content

Commit aa7664f

Browse files
authored
chore(ci): update codeql workflows (#6645)
1 parent 47d6ad9 commit aa7664f

12 files changed

+80
-69
lines changed

.github/workflows/authors-and-third-party-notices.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@ on:
88
branches:
99
- main
1010

11+
permissions:
12+
contents: none # We use the github app token to push the changes
13+
1114
jobs:
1215
update_generated_files:
1316
name: Update automatically generated files

.github/workflows/bump-packages.yaml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
branches:
66
- main
77

8+
permissions:
9+
contents: none # We use the github app token to open the PR
10+
811
jobs:
912
update_generated_files:
1013
name: Bump packages
@@ -21,6 +24,7 @@ jobs:
2124
with:
2225
# don't checkout a detatched HEAD
2326
ref: ${{ github.head_ref }}
27+
token: ${{ steps.app-token.outputs.token }}
2428

2529
- uses: actions/setup-node@v4
2630
with:
@@ -38,12 +42,8 @@ jobs:
3842
3943
- name: Bump packages
4044
env:
41-
LAST_BUMP_COMMIT_MESSAGE: "chore(release): bump package versions"
4245
SKIP_BUMP_PACKAGES: "mongodb-compass"
43-
run: |
44-
npm run bump-packages
45-
git add .
46-
git commit --no-allow-empty -m "$LAST_BUMP_COMMIT_MESSAGE" || true
46+
run: npm run bump-packages
4747

4848
- name: Create Pull Request
4949
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # 7.0.5

.github/workflows/check-pr-title.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,25 @@ on:
33
pull_request:
44
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled, converted_to_draft, edited]
55

6+
permissions:
7+
pull-requests: read # to read the PR title and labels
8+
69
jobs:
710
check-pr-title:
811
name: Check PR Title
912
runs-on: ubuntu-latest
1013
steps:
1114
- name: Enforce conventional commit style
12-
uses: realm/ci-actions/title-checker@main
15+
uses: realm/ci-actions/title-checker@d6cc8f067474759d38e6d24e272027b4c88bc0a9
1316
with:
1417
regex: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|ops){1}(\([\w\-\.]+\))?(!)?: .*'
1518
error-hint: 'Invalid PR title. Make sure it follows the conventional commit specification (i.e. "<type>(<optional scope>): <description>") or add the no-title-validation label'
16-
ignore-labels: 'no-title-validation'
19+
ignore-labels: "no-title-validation"
1720
- name: Enforce JIRA ticket in title
18-
uses: realm/ci-actions/title-checker@main
21+
uses: realm/ci-actions/title-checker@d6cc8f067474759d38e6d24e272027b4c88bc0a9
1922
# Skip the JIRA ticket check for PRs opened by bots
2023
if: ${{ !contains(github.event.pull_request.user.login, '[bot]') }}
2124
with:
22-
regex: '[A-Z]{4,10}-[0-9]{1,10}$'
23-
error-hint: 'Invalid PR title. Make sure it ends with a JIRA ticket - i.e. COMPASS-1234 or add the no-title-validation label'
24-
ignore-labels: 'no-title-validation'
25+
regex: "[A-Z]{4,10}-[0-9]{1,10}$"
26+
error-hint: "Invalid PR title. Make sure it ends with a JIRA ticket - i.e. COMPASS-1234 or add the no-title-validation label"
27+
ignore-labels: "no-title-validation"

.github/workflows/codeql.yml

Lines changed: 22 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,15 @@
1-
# For most projects, this workflow file will not need changing; you simply need
2-
# to commit it to your repository.
3-
#
4-
# You may wish to alter this file to override the set of languages analyzed,
5-
# or to provide custom queries or build logic.
6-
#
7-
# ******** NOTE ********
8-
# We have attempted to detect the languages in your repository. Please check
9-
# the `language` matrix defined below to confirm you have the correct set of
10-
# supported CodeQL languages.
11-
#
12-
name: "CodeQL"
1+
name: CodeQL
132

143
on:
154
push:
16-
branches: ["main", "*-releases"]
17-
tags: ["v*"]
5+
branches:
6+
- main
7+
- "*-releases"
8+
tags:
9+
- v*
1810
pull_request:
19-
# The branches below must be a subset of the branches above
20-
branches: ["main"]
11+
branches:
12+
- main
2113
schedule:
2214
- cron: "30 14 * * 4"
2315
workflow_dispatch:
@@ -26,8 +18,8 @@ on:
2618
jobs:
2719
analyze:
2820
name: Analyze
29-
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
30-
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
21+
runs-on: ubuntu-latest
22+
timeout-minutes: 360
3123
permissions:
3224
actions: read
3325
contents: read
@@ -36,26 +28,25 @@ jobs:
3628
strategy:
3729
fail-fast: false
3830
matrix:
39-
language: ["go", "javascript", "python"]
40-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
41-
# Use only 'java' to analyze code written in Java, Kotlin or both
42-
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
43-
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
31+
include:
32+
- language: go
33+
build-mode: autobuild
34+
- language: javascript
35+
build-mode: none
36+
- language: python
37+
build-mode: none
38+
- language: actions
39+
build-mode: none
4440

4541
steps:
4642
- name: Checkout repository
4743
uses: actions/checkout@v4
4844

49-
# Initializes the CodeQL tools for scanning.
5045
- name: Initialize CodeQL
51-
uses: github/codeql-action/init@v2
46+
uses: github/codeql-action/init@v3
5247
with:
5348
languages: ${{ matrix.language }}
54-
# If you wish to specify custom queries, you can do so here or in a config file.
55-
# By default, queries listed here will override any specified in a config file.
56-
# Prefix the list here with "+" to use these queries and those in the config file.
57-
58-
# For more details on CodeQL's query packs, refer to: https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
49+
build-mode: ${{ matrix.build-mode }}
5950
queries: security-extended
6051
config: |
6152
paths-ignore:
@@ -67,22 +58,7 @@ jobs:
6758
- '**/*.spec.tsx'
6859
- 'scripts/**'
6960
70-
# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
71-
# If this step fails, then you should remove it and run the build manually (see below)
72-
- name: Autobuild
73-
uses: github/codeql-action/autobuild@v2
74-
75-
# ℹ️ Command-line programs to run using the OS shell.
76-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
77-
78-
# If the Autobuild fails above, remove it and uncomment the following three lines.
79-
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
80-
81-
# - run: |
82-
# echo "Run, Build Application using script"
83-
# ./location_of_script_within_repo/buildscript.sh
84-
8561
- name: Perform CodeQL Analysis
86-
uses: github/codeql-action/analyze@v2
62+
uses: github/codeql-action/analyze@v3
8763
with:
8864
category: "/language:${{matrix.language}}"

.github/workflows/merge-bump-packages-pr.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
# Each Tuesday at 5 AM UTC
66
- cron: "0 5 * * 2"
77

8+
permissions:
9+
contents: none # We use the github app token to merge the PR
10+
811
jobs:
912
merge_bump_packages_pr:
1013
name: Merge bump packages PR

.github/workflows/publish-compass.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ on:
1111
release:
1212
types: [published]
1313

14+
permissions:
15+
contents: write # needed to publish the release
16+
1417
jobs:
1518
publish:
1619
name: Publish updated manifest to download center

.github/workflows/publish-packages.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ on:
99
branches:
1010
- main
1111

12+
permissions:
13+
contents: write # to push tags
14+
1215
jobs:
1316
publish:
1417
if: |

.github/workflows/release-notes-cleanup.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ on:
1212
release:
1313
types: [published, edited]
1414

15+
permissions:
16+
contents: write # to update the release notes
17+
1518
jobs:
1619
cleanup_notes:
1720
name: Cleanup Notes

.github/workflows/release-notes-labels.yaml

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ name: Release Notes - Labels
1010
on:
1111
pull_request:
1212
types: [opened, edited, labeled, unlabeled, synchronize]
13+
14+
permissions:
15+
pull-requests: write # to add and remove labels
16+
1317
jobs:
1418
label:
1519
runs-on: ubuntu-latest
@@ -20,41 +24,45 @@ jobs:
2024
if: |
2125
startsWith(github.event.pull_request.title, 'fix:') ||
2226
startsWith(github.event.pull_request.title, 'fix(')
23-
uses: actions-ecosystem/action-remove-labels@v1
27+
uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # 1.3.0
2428
with:
2529
labels: feat
30+
github_token: ${{ secrets.GITHUB_TOKEN }}
2631

2732
- name: remove label not matching title - feat
2833
if: |
2934
startsWith(github.event.pull_request.title, 'feat:') ||
3035
startsWith(github.event.pull_request.title, 'feat(')
31-
uses: actions-ecosystem/action-remove-labels@v1
36+
uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # 1.3.0
3237
with:
3338
labels: fix
39+
github_token: ${{ secrets.GITHUB_TOKEN }}
3440

3541
- name: add label based on title - fix
3642
if: |
3743
startsWith(github.event.pull_request.title, 'fix:') ||
3844
startsWith(github.event.pull_request.title, 'fix(')
39-
uses: actions-ecosystem/action-add-labels@v1
45+
uses: actions-ecosystem/action-add-labels@bd52874380e3909a1ac983768df6976535ece7f8 # 1.1.0
4046
with:
4147
labels: fix
48+
github_token: ${{ secrets.GITHUB_TOKEN }}
4249

4350
- name: add label based on title - feat
4451
if: |
4552
startsWith(github.event.pull_request.title, 'feat:') ||
4653
startsWith(github.event.pull_request.title, 'feat(')
47-
uses: actions-ecosystem/action-add-labels@v1
54+
uses: actions-ecosystem/action-add-labels@bd52874380e3909a1ac983768df6976535ece7f8 # 1.1.0
4855
with:
4956
labels: feat
57+
github_token: ${{ secrets.GITHUB_TOKEN }}
5058

51-
- uses: mheap/github-action-required-labels@v1
59+
- uses: mheap/github-action-required-labels@388fd6af37b34cdfe5a23b37060e763217e58b03 # 5.5.0
5260
with:
5361
mode: maximum
5462
count: 0
5563
labels: "wip, work in progress, work-in-progress"
5664

57-
- uses: mheap/github-action-required-labels@v1
65+
- uses: mheap/github-action-required-labels@388fd6af37b34cdfe5a23b37060e763217e58b03 # 5.5.0
5866
if: |
5967
startsWith(github.event.pull_request.title, 'fix:') ||
6068
startsWith(github.event.pull_request.title, 'fix(') ||

.github/workflows/start-beta.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
# Each Monday at 5 AM UTC
1515
- cron: "0 5 * * 1"
1616

17+
permissions:
18+
contents: write # To create the new branch and push it
19+
1720
jobs:
1821
startRelease:
1922
name: Start new Beta release

.github/workflows/start-ga.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ on:
1414
default: "beta-releases"
1515
required: false
1616

17+
permissions:
18+
contents: write # To create the new branch and push it
19+
1720
jobs:
1821
startRelease:
1922
name: Start new GA release

.github/workflows/update-electron.yaml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@ name: Update electron
44
on:
55
workflow_dispatch:
66
schedule:
7-
- cron: '0 0 * * *'
7+
- cron: "0 0 * * *"
8+
9+
permissions:
10+
contents: none # We use the github app token to push the changes
811

912
jobs:
1013
update_generated_files:
@@ -21,13 +24,13 @@ jobs:
2124
- uses: actions/checkout@v4
2225
with:
2326
# don't checkout a detatched HEAD
24-
ref: ${{ github.head_ref }}
27+
ref: ${{ github.head_ref || github.ref_name }}
2528
token: ${{ steps.app-token.outputs.token }}
2629

2730
- uses: actions/setup-node@v4
2831
with:
2932
node-version: 20.16.0
30-
cache: 'npm'
33+
cache: "npm"
3134

3235
- name: Install [email protected]
3336
run: |
@@ -43,10 +46,10 @@ jobs:
4346
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # 7.0.5
4447
with:
4548
token: ${{ steps.app-token.outputs.token }}
46-
commit-message: 'chore(deps): update electron'
49+
commit-message: "chore(deps): update electron"
4750
branch: ci/update-electron
48-
title: 'chore(deps): update electron'
51+
title: "chore(deps): update electron"
4952
labels: no-title-validation
50-
author: '${{ steps.app-token.outputs.app-slug}}[bot] <${{ steps.app-token.outputs.app-email }}>'
53+
author: "${{ steps.app-token.outputs.app-slug}}[bot] <${{ steps.app-token.outputs.app-email }}>"
5154
body: |
5255
- Update electron

0 commit comments

Comments
 (0)