Skip to content

Commit

Permalink
Update yarn.lock (octokit/rest) (#13303)
Browse files Browse the repository at this point in the history
* Update yarn.lock.
* Try switching to node 20.
* Increase action version. 
* Switch octokit to a dynamic import.
  • Loading branch information
sean-mcmanus authored Feb 22, 2025
1 parent c6e6355 commit 879202e
Show file tree
Hide file tree
Showing 4 changed files with 1,702 additions and 1,440 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/job-compile-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ jobs:
runs-on: ${{ inputs.runner-env }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Use Node.js 16
uses: actions/setup-node@v3
- name: Use Node.js 20
uses: actions/setup-node@v4
with:
node-version: 16
node-version: 20

- name: Install Dependencies
run: yarn install ${{ inputs.yarn-args }}
Expand Down
2 changes: 1 addition & 1 deletion Extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6542,7 +6542,7 @@
"build": "yarn prep:dts && echo [Building TypeScript code] && tsc --build tsconfig.json"
},
"devDependencies": {
"@octokit/rest": "^20.1.1",
"@octokit/rest": "^21.1.1",
"@types/glob": "^7.2.0",
"@types/mocha": "^10.0.6",
"@types/node": "^20.14.2",
Expand Down
21 changes: 9 additions & 12 deletions Extension/translations_auto_pr.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

const fs = require("fs-extra");
const cp = require("child_process");
const Octokit = require('@octokit/rest')
const path = require('path');
const parseGitConfig = require('parse-git-config');

Expand Down Expand Up @@ -179,23 +178,21 @@ if (existingUserEmail === undefined) {
cp.execSync(`git config --local user.email "${existingUserEmail}"`);
}

console.log(`pushing to remove branch (git push -f origin ${branchName})`);
console.log(`pushing to remote branch (git push -f origin ${branchName})`);
cp.execSync(`git push -f origin ${branchName}`);

console.log("Checking if there is already a pull request...");
const octokit = new Octokit.Octokit({auth: authToken});
octokit.pulls.list({ owner: repoOwner, repo: repoName }).then(({data}) => {
let alreadyHasPullRequest = false;
if (data) {
data.forEach((pr) => {
alreadyHasPullRequest = alreadyHasPullRequest || (pr.title === pullRequestTitle);
});
}

(async function() {
const { Octokit } = await import("@octokit/rest");
const octokit = new Octokit({ auth: authToken });
const { data } = await octokit.pulls.list({ owner: repoOwner, repo: repoName });
let alreadyHasPullRequest = data && data.some(pr => pr.title === pullRequestTitle);

// If not already present, create a PR against our remote branch.
if (!alreadyHasPullRequest) {
console.log("There is not already a pull request. Creating one.");
octokit.pulls.create({ body:"", owner: repoOwner, repo: repoName, title: pullRequestTitle, head: branchName, base: mergeTo });
await octokit.pulls.create({ body:"", owner: repoOwner, repo: repoName, title: pullRequestTitle, head: branchName, base: mergeTo });
} else {
console.log("There is already a pull request.");
}
Expand All @@ -212,4 +209,4 @@ octokit.pulls.list({ owner: repoOwner, repo: repoName }).then(({data}) => {

console.log(`Remove localization branch (git branch -D localization)`);
cp.execSync('git branch -D localization');
});
})();
Loading

0 comments on commit 879202e

Please sign in to comment.