Skip to content

Commit

Permalink
Merge branch 'main' into fix-NoSource-import-bug
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeNikitinNV authored Dec 17, 2024
2 parents eb7b936 + 4046562 commit 3b3dea1
Show file tree
Hide file tree
Showing 7 changed files with 150 additions and 6 deletions.
2 changes: 1 addition & 1 deletion .github/actions/build-vsix/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ runs:
shell: bash

- name: Upload VSIX
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ${{ inputs.artifact_name }}
path: ${{ inputs.vsix_name }}
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/smoke-tests/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ runs:

# Bits from the VSIX are reused by smokeTest.ts to speed things up.
- name: Download VSIX
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ${{ inputs.artifact_name }}

Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/issues-summary.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Issues Summary

on:
schedule:
- cron: '0 0 * * 2' # Runs every Tuesday at midnight
workflow_dispatch:

jobs:
generate-summary:
runs-on: ubuntu-latest

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

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install requests
- name: Run summary script
run: python scripts/generate_summary.py
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
14 changes: 12 additions & 2 deletions .github/workflows/pr-file-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,9 @@ name: PR files
on:
pull_request:
types:
# On by default if you specify no types.
- 'opened'
- 'reopened'
- 'synchronize'
# For `skip-label` only.
- 'labeled'
- 'unlabeled'

Expand Down Expand Up @@ -42,3 +40,15 @@ jobs:
.github/test_plan.md
skip-label: 'skip tests'
failure-message: 'TypeScript code was edited without also editing a ${file-pattern} file; see the Testing page in our wiki on testing guidelines (the ${skip-label} label can be used to pass this check)'

- name: 'Ensure PR has an associated issue'
uses: actions/github-script@v6
with:
script: |
const labels = context.payload.pull_request.labels.map(label => label.name);
if (!labels.includes('skip-issue-check')) {
const issueLink = context.payload.pull_request.body.match(/https:\/\/github\.com\/\S+\/issues\/\d+/);
if (!issueLink) {
core.setFailed('No associated issue found in the PR description.');
}
}
51 changes: 51 additions & 0 deletions .github/workflows/stale-prs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: Warn about month-old PRs

on:
schedule:
- cron: '0 0 */2 * *' # Runs every other day at midnight

jobs:
stale-prs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Warn about stale PRs
uses: actions/github-script@v4
with:
script: |
const { Octokit } = require("@octokit/rest");
const octokit = new Octokit({ auth: process.env.GITHUB_TOKEN });
const owner = context.repo.owner;
const repo = context.repo.repo;
const staleTime = new Date();
staleTime.setMonth(staleTime.getMonth() - 1);
const prs = await octokit.pulls.list({
owner,
repo,
state: 'open'
});
for (const pr of prs.data) {
const comments = await octokit.issues.listComments({
owner,
repo,
issue_number: pr.number
});
const lastComment = comments.data.length > 0 ? new Date(comments.data[comments.data.length - 1].created_at) : new Date(pr.created_at);
if (lastComment < staleTime) {
await octokit.issues.createComment({
owner,
repo,
issue_number: pr.number,
body: 'This PR has been stale for over a month. Please update or close it.'
});
}
}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
46 changes: 46 additions & 0 deletions scripts/generate_summary.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import requests
import os
from datetime import datetime, timezone

GITHUB_API_URL = "https://api.github.com"
REPO = "microsoft/vscode-python"
TOKEN = os.getenv("GITHUB_TOKEN")


def fetch_issues():
headers = {"Authorization": f"token {TOKEN}"}
query = f"{GITHUB_API_URL}/repos/{REPO}/issues?state=open&per_page=100"
response = requests.get(query, headers=headers)
response.raise_for_status()
return response.json()


def calculate_thumbs_up_per_day(issue):
created_at = datetime.strptime(issue["created_at"], "%Y-%m-%dT%H:%M:%SZ")
now = datetime.now(timezone.utc)
days_open = (now - created_at).days or 1
thumbs_up = next(
(group["count"] for group in issue["reactions"] if group["content"] == "+1"), 0
)
return thumbs_up / days_open


def generate_markdown_summary(issues):
summary = "| URL | Title | 👍/day |\n| --- | ----- | ------ |\n"
for issue in issues:
thumbs_up_per_day = calculate_thumbs_up_per_day(issue)
summary += (
f"| {issue['html_url']} | {issue['title']} | {thumbs_up_per_day:.2f} |\n"
)
return summary


def main():
issues = fetch_issues()
summary = generate_markdown_summary(issues)
with open("endorsement_velocity_summary.md", "w") as f:
f.write(summary)


if __name__ == "__main__":
main()
12 changes: 10 additions & 2 deletions src/client/common/pipes/namedPipes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { CancellationError, CancellationToken, Disposable } from 'vscode';
import { traceVerbose } from '../../logging';
import { isWindows } from '../utils/platform';
import { createDeferred } from '../utils/async';
import { noop } from '../utils/misc';

const { XDG_RUNTIME_DIR } = process.env;
export function generateRandomPipeName(prefix: string): string {
Expand Down Expand Up @@ -187,6 +188,13 @@ export async function createReaderPipe(pipeName: string, token?: CancellationTok
} catch {
// Intentionally ignored
}
const reader = fs.createReadStream(pipeName, { encoding: 'utf-8' });
return new rpc.StreamMessageReader(reader, 'utf-8');
const fd = await fs.open(pipeName, fs.constants.O_RDONLY | fs.constants.O_NONBLOCK);
const socket = new net.Socket({ fd });
const reader = new rpc.SocketMessageReader(socket, 'utf-8');
socket.on('close', () => {
fs.close(fd).catch(noop);
reader.dispose();
});

return reader;
}

0 comments on commit 3b3dea1

Please sign in to comment.