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

fix(CI): skip pull request checks for runs that don't include the token #327

Merged
merged 1 commit into from
Feb 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
11 changes: 8 additions & 3 deletions scripts/bump-version.mjs
Original file line number Diff line number Diff line change
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