diff --git a/__tests__/fs-helper.test.ts b/__tests__/fs-helper.test.ts index 5b2f5da..46f63fa 100644 --- a/__tests__/fs-helper.test.ts +++ b/__tests__/fs-helper.test.ts @@ -1,6 +1,5 @@ import * as fsHelper from '../src/fs-helper' import * as fs from 'fs' -import * as path from 'path' import * as os from 'os' import { execSync } from 'child_process' diff --git a/__tests__/ghcr-client.test.ts b/__tests__/ghcr-client.test.ts index 48bb0b8..b5545ab 100644 --- a/__tests__/ghcr-client.test.ts +++ b/__tests__/ghcr-client.test.ts @@ -12,7 +12,6 @@ let axiosHeadMock: jest.SpyInstance const token = 'test-token' const registry = new URL('https://ghcr.io') const repository = 'test-org/test-repo' -const releaseId = 'test-release-id' const semver = '1.2.3' const genericSha = '1234567890' // We should look at using different shas here to catch bug, but that make location validation harder const zipFile: fsHelper.FileMetadata = { @@ -119,7 +118,7 @@ describe('publishOCIArtifact', () => { if ((url as string).includes('manifest')) { return { status: 201, - headers: { 'Docker-Content-Digest': '1234567678' } + headers: { 'docker-content-digest': '1234567678' } } } @@ -175,7 +174,7 @@ describe('publishOCIArtifact', () => { if ((url as string).includes('manifest')) { return { status: 201, - headers: { 'Docker-Content-Digest': '1234567678' } + headers: { 'docker-content-digest': '1234567678' } } } @@ -244,7 +243,7 @@ describe('publishOCIArtifact', () => { if ((url as string).includes('manifest')) { return { status: 201, - headers: { 'Docker-Content-Digest': '1234567678' } + headers: { 'docker-content-digest': '1234567678' } } } diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index b74f2fd..97fc2d6 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -15,7 +15,6 @@ import * as ghcr from '../src/ghcr-client' import * as api from '../src/api-client' // Mock the GitHub Actions core library -let getInputMock: jest.SpyInstance let setFailedMock: jest.SpyInstance let setOutputMock: jest.SpyInstance @@ -37,7 +36,6 @@ describe('run', () => { jest.clearAllMocks() // Core mocks - getInputMock = jest.spyOn(core, 'getInput').mockImplementation() setFailedMock = jest.spyOn(core, 'setFailed').mockImplementation() setOutputMock = jest.spyOn(core, 'setOutput').mockImplementation() @@ -113,7 +111,7 @@ describe('run', () => { const invalidEvents = ['workflow_dispatch, pull_request, schedule'] for (const event of invalidEvents) { github.context.eventName = event - await main.run('') + await main.run() expect(setFailedMock).toHaveBeenCalledWith( 'This action can only be triggered by release events or tag push events.' ) @@ -357,7 +355,7 @@ describe('run', () => { publishOCIArtifactMock.mockImplementation(() => { return { packageURL: 'https://ghcr.io/v2/test-org/test-repo:1.2.3', - manifestDigest: 'my-test-digest' + manifestDigest: 'sha256:my-test-digest' } }) diff --git a/badges/coverage.svg b/badges/coverage.svg index abd228b..b52c8b0 100644 --- a/badges/coverage.svg +++ b/badges/coverage.svg @@ -1 +1 @@ -Coverage: 93.81%Coverage93.81% \ No newline at end of file +Coverage: 94.25%Coverage94.25% \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index b959b5e..c8a8451 100644 --- a/dist/index.js +++ b/dist/index.js @@ -74543,9 +74543,9 @@ exports.readFileContents = readFileContents; // Copy actions files from sourceDir to targetDir, excluding files and folders not relevant to the action // Errors if the repo appears to not contain any action files, such as an action.yml file function stageActionFiles(actionDir, targetDir) { - var actionYmlFound = false; + let actionYmlFound = false; fs_extra_1.default.copySync(actionDir, targetDir, { - filter: (src, dest) => { + filter: (src) => { const basename = path.basename(src); if (basename === 'action.yml' || basename === 'action.yaml') { actionYmlFound = true; @@ -74849,7 +74849,7 @@ exports.run = run; // In each case, the source event should produce a Semantic Version compliant tag representing the code to be packaged. function parseSourceSemanticVersion() { const event = github.context.eventName; - var semverTag = ''; + let semverTag = ''; // Grab the raw tag if (event === 'release') semverTag = github.context.payload.release.tag_name; diff --git a/src/api-client.ts b/src/api-client.ts index bb5cd9c..981b2ed 100644 --- a/src/api-client.ts +++ b/src/api-client.ts @@ -1,6 +1,3 @@ -import * as core from '@actions/core' -import * as github from '@actions/github' - export async function getRepositoryMetadata( repository: string, token: string diff --git a/src/fs-helper.ts b/src/fs-helper.ts index f9f7477..e2431de 100644 --- a/src/fs-helper.ts +++ b/src/fs-helper.ts @@ -97,11 +97,11 @@ export function readFileContents(filePath: string): Buffer { // Copy actions files from sourceDir to targetDir, excluding files and folders not relevant to the action // Errors if the repo appears to not contain any action files, such as an action.yml file -export function stageActionFiles(actionDir: string, targetDir: string) { - var actionYmlFound = false +export function stageActionFiles(actionDir: string, targetDir: string): void { + let actionYmlFound = false fsExtra.copySync(actionDir, targetDir, { - filter: (src: string, dest: string) => { + filter: (src: string) => { const basename = path.basename(src) if (basename === 'action.yml' || basename === 'action.yaml') { diff --git a/src/main.ts b/src/main.ts index bd7b9c7..b72ae7e 100644 --- a/src/main.ts +++ b/src/main.ts @@ -96,7 +96,7 @@ export async function run(): Promise { // In each case, the source event should produce a Semantic Version compliant tag representing the code to be packaged. function parseSourceSemanticVersion(): semver.SemVer { const event = github.context.eventName - var semverTag = '' + let semverTag = '' // Grab the raw tag if (event === 'release') semverTag = github.context.payload.release.tag_name