mirror of
https://github.com/actions/add-to-project.git
synced 2025-12-10 12:07:05 +00:00
fix dist check
This commit is contained in:
@@ -572,7 +572,7 @@ describe('addToProject', () => {
|
||||
const infoSpy = jest.spyOn(core, 'info')
|
||||
const gqlMock = mockGraphQL()
|
||||
await expect(addToProject()).rejects.toThrow(
|
||||
'Invalid project URL: https://github.com/orgs/github/repositories. Project URL should match the format <Github server domain name>/<orgs-or-users>/<ownerName>/projects/<projectNumber>',
|
||||
'Invalid project URL: https://github.com/orgs/github/repositories. Project URL should match the format <GitHub server domain name>/<orgs-or-users>/<ownerName>/projects/<projectNumber>',
|
||||
)
|
||||
expect(infoSpy).not.toHaveBeenCalled()
|
||||
expect(gqlMock).not.toHaveBeenCalled()
|
||||
|
||||
6
dist/index.js
generated
vendored
6
dist/index.js
generated
vendored
@@ -42,9 +42,7 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.mustGetOwnerTypeQuery = exports.addToProject = void 0;
|
||||
const core = __importStar(__nccwpck_require__(2186));
|
||||
const github = __importStar(__nccwpck_require__(5438));
|
||||
// TODO: Ensure this (and the Octokit client) works for non-github.com URLs, as well.
|
||||
// https://github.com/orgs|users/<ownerName>/projects/<projectNumber>
|
||||
const urlParse = /^(?:https:\/\/)?github\.com\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/;
|
||||
const urlParse = /\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/;
|
||||
function addToProject() {
|
||||
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
@@ -84,7 +82,7 @@ function addToProject() {
|
||||
core.debug(`Project URL: ${projectUrl}`);
|
||||
const urlMatch = projectUrl.match(urlParse);
|
||||
if (!urlMatch) {
|
||||
throw new Error(`Invalid project URL: ${projectUrl}. Project URL should match the format https://github.com/<orgs-or-users>/<ownerName>/projects/<projectNumber>`);
|
||||
throw new Error(`Invalid project URL: ${projectUrl}. Project URL should match the format <GitHub server domain name>/<orgs-or-users>/<ownerName>/projects/<projectNumber>`);
|
||||
}
|
||||
const projectOwnerName = (_e = urlMatch.groups) === null || _e === void 0 ? void 0 : _e.ownerName;
|
||||
const projectNumber = parseInt((_g = (_f = urlMatch.groups) === null || _f === void 0 ? void 0 : _f.projectNumber) !== null && _g !== void 0 ? _g : '', 10);
|
||||
|
||||
2
dist/index.js.map
generated
vendored
2
dist/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
@@ -1,8 +1,7 @@
|
||||
import * as core from '@actions/core'
|
||||
import * as github from '@actions/github'
|
||||
|
||||
const urlParse =
|
||||
/\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/
|
||||
const urlParse = /\/(?<ownerType>orgs|users)\/(?<ownerName>[^/]+)\/projects\/(?<projectNumber>\d+)/
|
||||
|
||||
interface ProjectNodeIDResponse {
|
||||
organization?: {
|
||||
|
||||
Reference in New Issue
Block a user