diff --git a/README.md b/README.md index 424d602..230375a 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ jobs: uses: actions/checkout@v4 - name: Publish id: publish - uses: actions/publish-immutable-action@0.0.2 + uses: actions/publish-immutable-action@0.0.3 ``` diff --git a/__tests__/fs-helper.test.ts b/__tests__/fs-helper.test.ts index 566b627..3ea4d9e 100644 --- a/__tests__/fs-helper.test.ts +++ b/__tests__/fs-helper.test.ts @@ -24,12 +24,6 @@ describe('stageActionFiles', () => { fs.rmSync(stagingDir, { recursive: true }) }) - it('returns an error if no action.yml file is present', () => { - expect(() => fsHelper.stageActionFiles(sourceDir, stagingDir)).toThrow( - /^No action.yml or action.yaml file found in source repository/ - ) - }) - it('copies all files (excluding the .git folder) to the staging directory', () => { fs.writeFileSync(`${sourceDir}/action.yml`, fileContent) @@ -50,23 +44,6 @@ describe('stageActionFiles', () => { // .git folder is not copied expect(fs.existsSync(`${stagingDir}/.git`)).toBe(false) }) - - it('copies all files (excluding the .git folder) to the staging directory, even if action.yml is in a subdirectory', () => { - fs.mkdirSync(`${sourceDir}/my-sub-action`, { recursive: true }) - fs.writeFileSync(`${sourceDir}/my-sub-action/action.yml`, fileContent) - - fsHelper.stageActionFiles(sourceDir, stagingDir) - expect(fs.existsSync(`${stagingDir}/src/main.js`)).toBe(true) - expect(fs.existsSync(`${stagingDir}/src/other.js`)).toBe(true) - expect(fs.existsSync(`${stagingDir}/my-sub-action/action.yml`)).toBe(true) - }) - - it('accepts action.yaml as a valid action file as well as action.yml', () => { - fs.writeFileSync(`${sourceDir}/action.yaml`, fileContent) - - fsHelper.stageActionFiles(sourceDir, stagingDir) - expect(fs.existsSync(`${stagingDir}/action.yaml`)).toBe(true) - }) }) describe('createArchives', () => { diff --git a/badges/coverage.svg b/badges/coverage.svg index ab35b08..b75435b 100644 --- a/badges/coverage.svg +++ b/badges/coverage.svg @@ -1 +1 @@ -Coverage: 97.1%Coverage97.1% \ No newline at end of file +Coverage: 97.06%Coverage97.06% \ No newline at end of file diff --git a/dist/index.js b/dist/index.js index 1d6ccdf..72d3b30 100644 --- a/dist/index.js +++ b/dist/index.js @@ -106597,15 +106597,10 @@ function readFileContents(filePath) { return fs.readFileSync(filePath); } // Copy actions files from sourceDir to targetDir, excluding the .git folder. -// Errors if the repo appears to not contain any action files, such as an action.yml file function stageActionFiles(actionDir, targetDir) { - let actionYmlFound = false; fs_extra_1.default.copySync(actionDir, targetDir, { filter: (src) => { const basename = path.basename(src); - if (basename === 'action.yml' || basename === 'action.yaml') { - actionYmlFound = true; - } // Filter out the .git folder. if (basename === '.git') { return false; @@ -106613,9 +106608,6 @@ function stageActionFiles(actionDir, targetDir) { return true; } }); - if (!actionYmlFound) { - throw new Error(`No action.yml or action.yaml file found in source repository`); - } } // Ensure the correct SHA is checked out for the tag by inspecting the git metadata in the workspace // and comparing it to the information actions provided us. diff --git a/src/fs-helper.ts b/src/fs-helper.ts index 497075b..e7e247d 100644 --- a/src/fs-helper.ts +++ b/src/fs-helper.ts @@ -91,18 +91,11 @@ export function readFileContents(filePath: string): Buffer { } // Copy actions files from sourceDir to targetDir, excluding the .git folder. -// Errors if the repo appears to not contain any action files, such as an action.yml file export function stageActionFiles(actionDir: string, targetDir: string): void { - let actionYmlFound = false - fsExtra.copySync(actionDir, targetDir, { filter: (src: string) => { const basename = path.basename(src) - if (basename === 'action.yml' || basename === 'action.yaml') { - actionYmlFound = true - } - // Filter out the .git folder. if (basename === '.git') { return false @@ -111,12 +104,6 @@ export function stageActionFiles(actionDir: string, targetDir: string): void { return true } }) - - if (!actionYmlFound) { - throw new Error( - `No action.yml or action.yaml file found in source repository` - ) - } } // Ensure the correct SHA is checked out for the tag by inspecting the git metadata in the workspace