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

This commit is contained in:
Vlad Frangu
2022-02-14 01:59:40 +02:00
committed by GitHub
parent 9af4b4776b
commit 0ad06fc639

View File

@@ -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)')) {
@@ -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,