Skip to content

chore(ci): update codeql workflows #6645

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

Merged
merged 5 commits into from
Jan 27, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/authors-and-third-party-notices.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
branches:
- main

permissions:
contents: none # We use the github app token to push the changes

jobs:
update_generated_files:
name: Update automatically generated files
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/bump-packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
branches:
- main

permissions:
contents: none # We use the github app token to open the PR

jobs:
update_generated_files:
name: Bump packages
Expand All @@ -21,6 +24,7 @@ jobs:
with:
# don't checkout a detatched HEAD
ref: ${{ github.head_ref }}
token: ${{ steps.app-token.outputs.token }}

- uses: actions/setup-node@v4
with:
Expand All @@ -38,12 +42,8 @@ jobs:

- name: Bump packages
env:
LAST_BUMP_COMMIT_MESSAGE: "chore(release): bump package versions"
SKIP_BUMP_PACKAGES: "mongodb-compass"
run: |
npm run bump-packages
git add .
git commit --no-allow-empty -m "$LAST_BUMP_COMMIT_MESSAGE" || true
run: npm run bump-packages

- name: Create Pull Request
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # 7.0.5
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/check-pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,25 @@ on:
pull_request:
types: [opened, synchronize, reopened, ready_for_review, labeled, unlabeled, converted_to_draft, edited]

permissions:
pull-requests: read # to read the PR title and labels

jobs:
check-pr-title:
name: Check PR Title
runs-on: ubuntu-latest
steps:
- name: Enforce conventional commit style
uses: realm/ci-actions/title-checker@main
uses: realm/ci-actions/title-checker@d6cc8f067474759d38e6d24e272027b4c88bc0a9
with:
regex: '^(build|chore|ci|docs|feat|fix|perf|refactor|revert|style|test|ops){1}(\([\w\-\.]+\))?(!)?: .*'
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'
ignore-labels: 'no-title-validation'
ignore-labels: "no-title-validation"
- name: Enforce JIRA ticket in title
uses: realm/ci-actions/title-checker@main
uses: realm/ci-actions/title-checker@d6cc8f067474759d38e6d24e272027b4c88bc0a9
# Skip the JIRA ticket check for PRs opened by bots
if: ${{ !contains(github.event.pull_request.user.login, '[bot]') }}
with:
regex: '[A-Z]{4,10}-[0-9]{1,10}$'
error-hint: 'Invalid PR title. Make sure it ends with a JIRA ticket - i.e. COMPASS-1234 or add the no-title-validation label'
ignore-labels: 'no-title-validation'
regex: "[A-Z]{4,10}-[0-9]{1,10}$"
error-hint: "Invalid PR title. Make sure it ends with a JIRA ticket - i.e. COMPASS-1234 or add the no-title-validation label"
ignore-labels: "no-title-validation"
68 changes: 22 additions & 46 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,23 +1,15 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
name: CodeQL

on:
push:
branches: ["main", "*-releases"]
tags: ["v*"]
branches:
- main
- "*-releases"
tags:
- v*
pull_request:
# The branches below must be a subset of the branches above
branches: ["main"]
branches:
- main
schedule:
- cron: "30 14 * * 4"
workflow_dispatch:
Expand All @@ -26,8 +18,8 @@ on:
jobs:
analyze:
name: Analyze
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
timeout-minutes: ${{ (matrix.language == 'swift' && 120) || 360 }}
runs-on: ubuntu-latest
timeout-minutes: 360
permissions:
actions: read
contents: read
Expand All @@ -36,26 +28,25 @@ jobs:
strategy:
fail-fast: false
matrix:
language: ["go", "javascript", "python"]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby', 'swift' ]
# Use only 'java' to analyze code written in Java, Kotlin or both
# Use only 'javascript' to analyze code written in JavaScript, TypeScript or both
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
include:
- language: go
build-mode: autobuild
- language: javascript
build-mode: none
- language: python
build-mode: none
- language: actions
build-mode: none

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.

# 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
build-mode: ${{ matrix.build-mode }}
queries: security-extended
config: |
paths-ignore:
Expand All @@ -67,22 +58,7 @@ jobs:
- '**/*.spec.tsx'
- 'scripts/**'

# Autobuild attempts to build any compiled languages (C/C++, C#, Go, Java, or Swift).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun

# If the Autobuild fails above, remove it and uncomment the following three lines.
# modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.

# - run: |
# echo "Run, Build Application using script"
# ./location_of_script_within_repo/buildscript.sh

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
3 changes: 3 additions & 0 deletions .github/workflows/merge-bump-packages-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on:
# Each Tuesday at 5 AM UTC
- cron: "0 5 * * 2"

permissions:
contents: none # We use the github app token to merge the PR

jobs:
merge_bump_packages_pr:
name: Merge bump packages PR
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish-compass.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:
release:
types: [published]

permissions:
contents: write # needed to publish the release

jobs:
publish:
name: Publish updated manifest to download center
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/publish-packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
branches:
- main

permissions:
contents: write # to push tags

jobs:
publish:
if: |
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/release-notes-cleanup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ on:
release:
types: [published, edited]

permissions:
contents: write # to update the release notes

jobs:
cleanup_notes:
name: Cleanup Notes
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/release-notes-labels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ name: Release Notes - Labels
on:
pull_request:
types: [opened, edited, labeled, unlabeled, synchronize]

permissions:
pull-requests: write # to add and remove labels

jobs:
label:
runs-on: ubuntu-latest
Expand All @@ -20,41 +24,45 @@ jobs:
if: |
startsWith(github.event.pull_request.title, 'fix:') ||
startsWith(github.event.pull_request.title, 'fix(')
uses: actions-ecosystem/action-remove-labels@v1
uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # 1.3.0
with:
labels: feat
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: remove label not matching title - feat
if: |
startsWith(github.event.pull_request.title, 'feat:') ||
startsWith(github.event.pull_request.title, 'feat(')
uses: actions-ecosystem/action-remove-labels@v1
uses: actions-ecosystem/action-remove-labels@2ce5d41b4b6aa8503e285553f75ed56e0a40bae0 # 1.3.0
with:
labels: fix
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: add label based on title - fix
if: |
startsWith(github.event.pull_request.title, 'fix:') ||
startsWith(github.event.pull_request.title, 'fix(')
uses: actions-ecosystem/action-add-labels@v1
uses: actions-ecosystem/action-add-labels@bd52874380e3909a1ac983768df6976535ece7f8 # 1.1.0
with:
labels: fix
github_token: ${{ secrets.GITHUB_TOKEN }}

- name: add label based on title - feat
if: |
startsWith(github.event.pull_request.title, 'feat:') ||
startsWith(github.event.pull_request.title, 'feat(')
uses: actions-ecosystem/action-add-labels@v1
uses: actions-ecosystem/action-add-labels@bd52874380e3909a1ac983768df6976535ece7f8 # 1.1.0
with:
labels: feat
github_token: ${{ secrets.GITHUB_TOKEN }}

- uses: mheap/github-action-required-labels@v1
- uses: mheap/github-action-required-labels@388fd6af37b34cdfe5a23b37060e763217e58b03 # 5.5.0
with:
mode: maximum
count: 0
labels: "wip, work in progress, work-in-progress"

- uses: mheap/github-action-required-labels@v1
- uses: mheap/github-action-required-labels@388fd6af37b34cdfe5a23b37060e763217e58b03 # 5.5.0
if: |
startsWith(github.event.pull_request.title, 'fix:') ||
startsWith(github.event.pull_request.title, 'fix(') ||
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/start-beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
# Each Monday at 5 AM UTC
- cron: "0 5 * * 1"

permissions:
contents: write # To create the new branch and push it

jobs:
startRelease:
name: Start new Beta release
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/start-ga.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ on:
default: "beta-releases"
required: false

permissions:
contents: write # To create the new branch and push it

jobs:
startRelease:
name: Start new GA release
Expand Down
15 changes: 9 additions & 6 deletions .github/workflows/update-electron.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@ name: Update electron
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
- cron: "0 0 * * *"

permissions:
contents: none # We use the github app token to push the changes

jobs:
update_generated_files:
Expand All @@ -21,13 +24,13 @@ jobs:
- uses: actions/checkout@v4
with:
# don't checkout a detatched HEAD
ref: ${{ github.head_ref }}
ref: ${{ github.head_ref || github.ref_name }}
token: ${{ steps.app-token.outputs.token }}

- uses: actions/setup-node@v4
with:
node-version: 20.16.0
cache: 'npm'
cache: "npm"

- name: Install [email protected]
run: |
Expand All @@ -43,10 +46,10 @@ jobs:
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # 7.0.5
with:
token: ${{ steps.app-token.outputs.token }}
commit-message: 'chore(deps): update electron'
commit-message: "chore(deps): update electron"
branch: ci/update-electron
title: 'chore(deps): update electron'
title: "chore(deps): update electron"
labels: no-title-validation
author: '${{ steps.app-token.outputs.app-slug}}[bot] <${{ steps.app-token.outputs.app-email }}>'
author: "${{ steps.app-token.outputs.app-slug}}[bot] <${{ steps.app-token.outputs.app-email }}>"
body: |
- Update electron
Loading