import {Action} from "../src/Action"; import * as github from "@actions/github"; import {Inputs} from "../src/Inputs"; import {GithubReleases} from "../src/Releases"; import {GithubArtifactUploader} from "../src/ArtifactUploader"; import * as path from "path"; import {FileArtifactGlobber} from "../src/ArtifactGlobber"; // This test is currently intended to be manually run during development. To run: // - Make sure you have an environment variable named GITHUB_TOKEN assigned to your token // - Remove skip from the test below describe.skip('Integration Test', () => { let action: Action beforeEach(() => { const token = getToken() const git = github.getOctokit(token) const inputs = getInputs() const releases = new GithubReleases(inputs, git) const uploader = new GithubArtifactUploader(releases, inputs.replacesArtifacts) action = new Action(inputs, releases, uploader) }) it('Performs action', async () => { await action.perform() }) function getInputs(): Inputs { const MockInputs = jest.fn(() => { return { allowUpdates: true, artifacts: artifacts(), createdReleaseBody: "This release was generated by release-action's integration test", createdReleaseName: "Releases Action Integration Test", commit: "", draft: false, owner: "ncipollo", prerelease: false, replacesArtifacts: true, repo: "actions-playground", tag: "release-action-test", token: getToken(), updatedReleaseBody: "This release was generated by release-action's integration test", updatedReleaseName: "Releases Action Integration Test" } }) return new MockInputs(); } function artifacts() { const globber = new FileArtifactGlobber() const artifactPath = path.join(__dirname, 'Integration.test.ts') const artifactString = `~/Desktop/test.txt,blarg.tx, ${artifactPath}` return globber.globArtifactString(artifactString, "raw") } function getToken(): string { return process.env.GITHUB_TOKEN ?? "" } })