mirror of
https://github.com/LukeHagar/vercel.git
synced 2025-12-10 12:57:47 +00:00
[tests] Don't run tests in forks (#3713)
There is no need to run the tests in a fork because when the forked repo submits a PR to this repo, the tests will run.
This commit is contained in:
@@ -1,14 +1,15 @@
|
|||||||
const fetch = require('node-fetch');
|
const fetch = require('node-fetch');
|
||||||
|
|
||||||
|
const repo = process.env.GITHUB_REPOSITORY; // 'zeit/now'
|
||||||
const ref = process.env.GITHUB_REF.slice(11); // 'refs/heads/ci-cancel-previous',
|
const ref = process.env.GITHUB_REF.slice(11); // 'refs/heads/ci-cancel-previous',
|
||||||
const sha = process.env.GITHUB_SHA; // 'a5d18518ea755ddc4212f47ec3448f59e0e7e3a5',
|
const sha = process.env.GITHUB_SHA; // 'a5d18518ea755ddc4212f47ec3448f59e0e7e3a5',
|
||||||
const run = process.env.GITHUB_RUN_ID; // '33175268',
|
const run = process.env.GITHUB_RUN_ID; // '33175268',
|
||||||
const event = process.env.GITHUB_EVENT_NAME; // 'push'
|
const event = process.env.GITHUB_EVENT_NAME; // 'push'
|
||||||
const token = process.env.GITHUB_WORKFLOW_TOKEN; // access token with `public_repo` scope added to repo secrets
|
const token = process.env.GITHUB_WORKFLOW_TOKEN; // access token with `public_repo` scope added to repo secrets
|
||||||
const workflow = 'continuous-integration.yml';
|
const workflow = 'continuous-integration.yml';
|
||||||
console.log({ ref, sha, run, event, workflow });
|
console.log({ repo, ref, sha, run, event, workflow });
|
||||||
|
|
||||||
const url = `https://api.github.com/repos/zeit/now/actions/workflows/${workflow}/runs`;
|
const url = `https://api.github.com/repos/${repo}/actions/workflows/${workflow}/runs`;
|
||||||
const opts = {
|
const opts = {
|
||||||
headers: {
|
headers: {
|
||||||
Accept: 'application/vnd.github.v3+json',
|
Accept: 'application/vnd.github.v3+json',
|
||||||
|
|||||||
@@ -2,6 +2,14 @@ const { execSync, spawn } = require('child_process');
|
|||||||
const { join, relative } = require('path');
|
const { join, relative } = require('path');
|
||||||
const { readdirSync } = require('fs');
|
const { readdirSync } = require('fs');
|
||||||
|
|
||||||
|
if (
|
||||||
|
process.env.GITHUB_REPOSITORY &&
|
||||||
|
process.env.GITHUB_REPOSITORY !== 'zeit/now'
|
||||||
|
) {
|
||||||
|
console.log('Detected fork, skipping tests');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
process.chdir(join(__dirname, '..'));
|
process.chdir(join(__dirname, '..'));
|
||||||
|
|
||||||
async function main() {
|
async function main() {
|
||||||
|
|||||||
Reference in New Issue
Block a user