Skip to content

Commit

Permalink
fix(CI): skip pull request checks for runs that don't include the tok…
Browse files Browse the repository at this point in the history
…en (#327)
  • Loading branch information
vladfrangu committed Feb 13, 2022
1 parent 9af4b47 commit 0ad06fc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions scripts/bump-version.mjs
Expand Up @@ -4,9 +4,6 @@ import conventionalRecommendedBump from 'conventional-recommended-bump';
import { execSync } from 'node:child_process';
import { promisify } from 'node:util';

const octokit = new Octokit();
const [OWNER, REPOSITORY] = process.env.GITHUB_REPOSITORY.split('/');

const lastCommitMessage = execSync('git log -1 --pretty=%B', { encoding: 'utf8' });

if (lastCommitMessage.startsWith('chore(release)')) {
Expand Down Expand Up @@ -45,6 +42,14 @@ console.info(
`✅ Done! discord-api-types was bumped to ${newVersion['discord-api-types']}! Checking if there was a pull request open already and closing it if so...`,
);

if (!process.env.GITHUB_TOKEN) {
console.info('🙉 Skipping the pull request checks as no GITHUB_TOKEN was provided.');
process.exit(0);
}

const octokit = new Octokit();
const [OWNER, REPOSITORY] = process.env.GITHUB_REPOSITORY.split('/');

const pullRequests = await octokit.pulls.list({
owner: OWNER,
repo: REPOSITORY,
Expand Down

0 comments on commit 0ad06fc

Please sign in to comment.