Skip to content

Add GitHub labels #15

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 20 commits into from
Jun 13, 2023
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
14 changes: 14 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[flake8]
ignore = W,BLK,
E24,E121,E123,E125,E126,E221,E226,E266,E704,
E265,E722,E501,E731,E306,E401,E302,E222,E303,
E402,E305,E261,E262,E203
exclude =
__pycache__,
.eggs,
.git,
.tox,
.nox,
build,
dist,
src/test/python_tests/test_data
63 changes: 63 additions & 0 deletions .github/actions/build-vsix/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: 'Build VSIX'
description: "Build the extension's VSIX"

inputs:
node_version:
description: 'Version of Node to install'
required: true

runs:
using: 'composite'
steps:
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node_version }}
cache: 'npm'

# Minimum supported version is Python 3.7
- name: Use Python 3.7
uses: actions/setup-python@v4
with:
python-version: 3.7

- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-build-vsix-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-build-vsix-

# For faster/better builds of sdists.
- name: Update pip, install pipx and install wheel
run: python -m pip install -U pip pipx wheel
shell: bash

- name: Run npm ci
run: npm ci --prefer-offline
shell: bash

- name: Install bundled python libraries
run: pipx run nox --session install_bundled_libs
shell: bash

# Use the GITHUB_RUN_ID environment variable to update the build number.
# GITHUB_RUN_ID is a unique number for each run within a repository.
# This number does not change if you re-run the workflow run.
- name: Update extension build number
run: pipx run nox --session update_build_number -- $GITHUB_RUN_ID
shell: bash

- name: Build VSIX
run: npm run vsce-package
shell: bash

- name: Upload VSIX
uses: actions/upload-artifact@v3
with:
name: linter-package
path: |
**/*.vsix
if-no-files-found: error
retention-days: 7
55 changes: 55 additions & 0 deletions .github/actions/lint/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: 'Lint'
description: 'Lint TypeScript and Python code'

inputs:
node_version:
description: 'Version of Node to install'
required: true

runs:
using: 'composite'
steps:
- name: Install Node
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.node_version }}
cache: 'npm'

- name: Install Node dependencies
run: npm ci
shell: bash

- name: Lint TypeScript code
run: npm run lint
shell: bash

- name: Check TypeScript format
run: npm run format-check
shell: bash

- name: Install Python
uses: actions/setup-python@v4
with:
python-version: '3.7'

- name: Pip cache
uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-lint-${{ hashFiles('**/requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-lint-

# For faster/better builds of sdists.
- name: Update pip, install pipx and install wheel
run: python -m pip install -U pip pipx wheel
shell: bash

# This will install libraries to a target directory.
- name: Install bundled python libraries
run: pipx run nox --session install_bundled_libs
shell: bash

- name: Check linting and formatting
run: pipx run nox --session lint
shell: bash
43 changes: 43 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
version: 2
updates:
- package-ecosystem: 'github-actions'
directory: /
schedule:
interval: monthly
labels:
- 'no-changelog'

- package-ecosystem: 'github-actions'
directory: .github/actions/lint
schedule:
interval: monthly
labels:
- 'no-changelog'

- package-ecosystem: 'github-actions'
directory: .github/actions/build-vsix
schedule:
interval: monthly
labels:
- 'no-changelog'

- package-ecosystem: 'pip'
directory: /
schedule:
interval: daily
labels:
- 'debt'
commit-message:
include: 'scope'
prefix: 'pip'

- package-ecosystem: 'npm'
directory: /
schedule:
interval: monthly
labels:
- 'no-changelog'
ignore:
- dependency-name: '@types/vscode'
- dependency-name: '@types/node'
- dependency-name: 'vscode-languageclient'
17 changes: 17 additions & 0 deletions .github/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
changelog:
exclude:
labels:
- 'no-changelog'

categories:
- title: Enhancements
labels:
- 'feature-request'

- title: Bug Fixes
labels:
- 'bug'

- title: Code Health
labels:
- 'debt'
70 changes: 70 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
# 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'

on:
push:
branches: [main]
pull_request:
# The branches below must be a subset of the branches above
branches: [main]
schedule:
- cron: '15 16 * * 2'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write

strategy:
fail-fast: false
matrix:
language: ['javascript', 'python']
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
# Learn more about CodeQL language support at https://git.io/codeql-language-support

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

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
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.
# queries: ./path/to/local/query, your-org/your-repo/queries@main

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# 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.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
39 changes: 39 additions & 0 deletions .github/workflows/issue-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Issue labels

on:
issues:
types: [opened, reopened]

permissions:
issues: write

jobs:
# From https://github.com/marketplace/actions/github-script#apply-a-label-to-an-issue.
add-triage-label:
name: "Add 'triage-needed'"
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const result = await github.rest.issues.listLabelsOnIssue({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
})
const labels = result.data.map((label) => label.name)
const hasNeeds = labels.some((label) => label.startsWith('needs'))

if (!hasNeeds) {
console.log('This issue is not labeled with a "needs __" label, add the "triage-needed" label.')

github.rest.issues.addLabels({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
labels: ['triage-needed']
})
} else {
console.log('This issue already has a "needs __" label, do not add the "triage-needed" label.')
}
Comment on lines +1 to +39
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should be using microsoft/vscode-github-triage-actions

Loading