Skip to content
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

Update workflow improvements #7552

Merged
merged 3 commits into from
Dec 21, 2024
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
28 changes: 23 additions & 5 deletions .github/workflows/upgrade-jupyterlab-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ on:
default: main
required: false
type: string
target_repo:
description: 'Target repository'
required: false
default: jupyter/notebook
type: string

env:
version_tag: 'latest'
Expand Down Expand Up @@ -68,13 +73,17 @@ jobs:
echo "latest=${LATEST}" >> $GITHUB_ENV
jlpm upgrade:lab:dependencies --set-version ${LATEST}
if [[ ! -z "$(git status --porcelain package.json)" ]]; then
jlpm install
jlpm
jlpm deduplicate

cd ui-tests
jlpm
jlpm deduplicate
fi

- name: Create a PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
run: |
set -eux

Expand All @@ -95,9 +104,18 @@ jobs:
git commit . -m "Update to JupyterLab v${LATEST}"

git push --set-upstream origin "${BRANCH_NAME}"
gh pr create \
--base ${{ inputs.branch || 'main' }} \
--title "Update to JupyterLab v${LATEST}" \

PR_ARGS=(
--base "${{ inputs.branch || 'main' }}"
--title "Update to JupyterLab v${LATEST}"
--body "New JupyterLab release [v${LATEST}](https://github.com/jupyterlab/jupyterlab/releases/tag/v${LATEST}) is available. Please review the lock file carefully."
)

# Add --repo flag only if target_repo is specified
if [[ -n "${{ inputs.target_repo }}" ]]; then
PR_ARGS+=(--repo "${{ inputs.target_repo }}")
fi

gh pr create "${PR_ARGS[@]}"
fi
fi
11 changes: 11 additions & 0 deletions buildutils/src/upgrade-lab-dependencies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const PACKAGE_JSON_PATHS: string[] = [
'packages/tree-extension/package.json',
'packages/tree/package.json',
'packages/ui-components/package.json',
'ui-tests/package.json',
];

const DEPENDENCY_GROUP = '@jupyterlab';
Expand Down Expand Up @@ -78,7 +79,16 @@ async function updatePackageJson(newVersion: string): Promise<void> {
throw new Error(errorMessage);
}

// fetch the new galata version
const galataUrl = `https://raw.githubusercontent.com/jupyterlab/jupyterlab/v${newVersion}/galata/package.json`;
const galataResponse = await fetch(galataUrl);
if (!galataResponse.ok) {
const errorMessage = `Failed to fetch galata/package.json from ${galataUrl}. HTTP status code: ${galataResponse.status}`;
throw new Error(errorMessage);
}

const newPackageJson = await response.json();
const galataPackageJson = await galataResponse.json();

for (const packageJsonPath of PACKAGE_JSON_PATHS) {
const filePath: string = path.resolve(packageJsonPath);
Expand All @@ -87,6 +97,7 @@ async function updatePackageJson(newVersion: string): Promise<void> {
const newDependencies = {
...newPackageJson.devDependencies,
...newPackageJson.resolutions,
[galataPackageJson.name]: galataPackageJson.version,
};

updateDependencyVersion(existingPackageJson, newDependencies);
Expand Down
2 changes: 1 addition & 1 deletion ui-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
"license": "BSD-3-Clause",
"description": "Jupyter Notebook UI Tests",
"scripts": {
"deduplicate": "jlpm dlx yarn-berry-deduplicate -s fewerHighest && jlpm install",
"rimraf": "rimraf",
"start": "jupyter notebook --config test/jupyter_server_config.py",
"start:detached": "yarn run start&",
"test": "playwright test",
"test:debug": "PWDEBUG=1 playwright test",
"test:report": "http-server ./playwright-report -a localhost -o",
Expand Down
Loading