Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: giggio/node-chromedriver
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 117.0.2
Choose a base ref
...
head repository: giggio/node-chromedriver
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 117.0.3
Choose a head ref
  • 10 commits
  • 6 files changed
  • 2 contributors

Commits on Sep 21, 2023

  1. Verified

    This commit was signed with the committer’s verified signature.
    giggio Giovanni Bassi
    Copy the full SHA
    87e8749 View commit details
  2. Checkout on action

    giggio committed Sep 21, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    giggio Giovanni Bassi
    Copy the full SHA
    92e5845 View commit details
  3. Verified

    This commit was signed with the committer’s verified signature.
    giggio Giovanni Bassi
    Copy the full SHA
    2d6a5d6 View commit details
  4. Fix version for action

    giggio committed Sep 21, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    giggio Giovanni Bassi
    Copy the full SHA
    a81ea10 View commit details

Commits on Sep 22, 2023

  1. Add create tag gh action

    giggio committed Sep 22, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    giggio Giovanni Bassi
    Copy the full SHA
    e77c025 View commit details
  2. Checkout during tag action

    giggio committed Sep 22, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    giggio Giovanni Bassi
    Copy the full SHA
    13b621c View commit details
  3. Fix tag action script

    giggio committed Sep 22, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    giggio Giovanni Bassi
    Copy the full SHA
    afe9bf9 View commit details

Commits on Sep 25, 2023

  1. Creates the intermediate tmp folder before attempting to copy CHROMED…

    …RIVER_FILEPATH to it.
    
    Copying the binary no longer worked, unless the destination tmp folder already existed.
    
    Steps to reproduce:
    - rm -Rf /tmp/117.0.5938.92/chromedriver/
    - CHROMEDRIVER_FILEPATH="/yourpathto/chromedriver" node node_modules/chromedriver/install.js
    
    Failed with:
    ```
    ChromeDriver installation failed Error: ENOENT: no such file or directory, copyfile '/tmp/chromedriver' -> '/tmp/117.0.5938.92/chromedriver/chromedriver-linux64/chromedriver'
        at Object.copyFileSync (node:fs:2894:3)
        at extractDownload (/home/anastasios/Sources/cloud/web/node_modules/chromedriver/install.js:364:8)
        at install (/home/anastasios/Sources/cloud/web/node_modules/chromedriver/install.js:70:13)
        at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
      errno: -2,
      syscall: 'copyfile',
      code: 'ENOENT',
      path: '/tmp/chromedriver',
      dest: '/tmp/117.0.5938.92/chromedriver/chromedriver-linux64/chromedriver'
    }
    ```
    
    After this change it succeeds.
    anastasios-captureone authored and giggio committed Sep 25, 2023

    Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    6c4011c View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    giggio Giovanni Bassi
    Copy the full SHA
    ce13f36 View commit details
  3. Fix tag gh action script

    404 status throws errors, we are catching that.
    giggio committed Sep 25, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    giggio Giovanni Bassi
    Copy the full SHA
    82a6380 View commit details
Showing with 122 additions and 9 deletions.
  1. +40 −0 .github/workflows/check-for-update.yml
  2. +69 −0 .github/workflows/tag.yml
  3. +1 −0 install.js
  4. +2 −2 package-lock.json
  5. +1 −1 package.json
  6. +9 −6 update.js
40 changes: 40 additions & 0 deletions .github/workflows/check-for-update.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: "Check for update"

on:
schedule:
- cron: "0 1 * * *"
workflow_dispatch:

permissions:
pull-requests: write

jobs:
check-for-updates:
name: Check for updates
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- run: |
npm ci
./update.js --no-commit
VERSION=`node --eval 'console.log(require("./package.json").version)'`
echo "NEW_VERSION=$VERSION" >> "$GITHUB_OUTPUT"
id: update
name: Run update
- uses: peter-evans/create-pull-request@v5
name: Create Pull Request
with:
commit-message: Bump version to ${{ steps.update.outputs.NEW_VERSION }}
branch: update-${{ steps.update.outputs.NEW_VERSION }}
delete-branch: true
title: Bump version to ${{ steps.update.outputs.NEW_VERSION }}
body: |
Update Chromedriver to version `${{ steps.update.outputs.NEW_VERSION }}`.
See: https://googlechromelabs.github.io/chrome-for-testing/
labels: |
update chromedriver
assignees: giggio
reviewers: giggio
69 changes: 69 additions & 0 deletions .github/workflows/tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
name: Create tag

on:
workflow_dispatch:

permissions:
contents: write

jobs:
tag:
name: Create Tag
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- run: |
VERSION=`node --eval 'console.log(require("./package.json").version)'`
echo "VERSION=$VERSION" >> "$GITHUB_OUTPUT"
id: version
name: Get version number
- uses: actions/github-script@v6
name: Create tag
with:
script: |
try {
const tag = await github.rest.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'tags/${{ steps.version.outputs.VERSION }}'
});
if (tag != null && tag.status == 200) {
console.log('Tag ${{ steps.version.outputs.VERSION }} already exists.');
return;
}
} catch (error) {
if (error.status !== 404) {
console.error('Error when trying to get tag ${{ steps.version.outputs.VERSION }}.');
return;
}
}
const main = await github.rest.git.getRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'heads/main'
});
const createdTag = await github.rest.git.createTag({
owner: context.repo.owner,
repo: context.repo.repo,
tag: '${{ steps.version.outputs.VERSION }}',
message: 'Bump version to ${{ steps.version.outputs.VERSION }}',
object: main.data.object.sha,
type: 'commit'
});
if (createdTag.status !== 201) {
console.error('Could not create tag ${{ steps.version.outputs.VERSION }}.');
}
const createdRef = await github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/${{ steps.version.outputs.VERSION }}',
sha: createdTag.data.sha
});
if (createdRef.status === 201) {
console.log('Tag ${{ steps.version.outputs.VERSION }} was created successfully');
} else {
console.error('Could not create ref ${{ steps.version.outputs.VERSION }}.');
}
1 change: 1 addition & 0 deletions install.js
Original file line number Diff line number Diff line change
@@ -359,6 +359,7 @@ async function requestBinary(requestOptions, filePath) {
*/
async function extractDownload(dirToExtractTo, chromedriverBinaryFilePath, downloadedFile) {
if (path.extname(downloadedFile) !== '.zip') {
fs.mkdirSync(path.dirname(chromedriverBinaryFilePath), {recursive: true});
fs.copyFileSync(downloadedFile, chromedriverBinaryFilePath);
console.log('Skipping zip extraction - binary file found.');
return;
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "chromedriver",
"version": "117.0.2",
"version": "117.0.3",
"keywords": [
"chromedriver",
"selenium"
15 changes: 9 additions & 6 deletions update.js
Original file line number Diff line number Diff line change
@@ -15,7 +15,7 @@ async function getLatest() {
const data = await res.json();
return data?.channels?.Stable?.version;
} catch (err) {
console.log(err);
console.error(err);
process.exit(1);
}
}
@@ -26,7 +26,7 @@ async function getLatest() {
- add a git tag using the new node-chromedriver version
- add a git commit, e.g. Bump version to 77.0.0
*/
async function writeUpdate(newVersion) {
async function writeUpdate(newVersion, shouldCommit) {
const helper = fs.readFileSync('./lib/chromedriver.js', 'utf8');
const versionExport = 'exports.version';
const regex = new RegExp(`^.*${versionExport}.*$`, 'gm');
@@ -36,23 +36,26 @@ async function writeUpdate(newVersion) {
const version = currentMajor !== newMajor ? `${newMajor}.0.0` : semver.inc(currentVersionInPackageJson, 'patch');
execSync(`npm version ${version} --git-tag-version=false`);
fs.writeFileSync('./lib/chromedriver.js', updated, 'utf8');
if (!shouldCommit) return;
execSync('git add :/');
execSync(`git commit -m "Bump version to ${version}"`);
execSync(`git tag -s ${version} -m ${version}`);
}

async function run() {
async function run(shouldCommit) {
try {
const latestVersion = await getLatest();
if (currentChromedriverVersion === latestVersion) {
console.log('Chromedriver version is up to date.');
} else {
writeUpdate(latestVersion);
writeUpdate(latestVersion, shouldCommit);
console.log(`Chromedriver version updated to ${latestVersion}`);
}
} catch (err) {
console.log(err);
console.error(err);
process.exit(1);
}
}

run();
const shouldCommit = process.argv.indexOf('--no-commit') == -1;
run(shouldCommit);