From 4bf916289e5e32bb7d1bd7f21842c3afeab3b25a Mon Sep 17 00:00:00 2001 From: madhead Date: Fri, 19 Feb 2021 18:02:58 +0300 Subject: [PATCH 1/4] =?UTF-8?q?master=20=E2=86=92=20main=20(#596)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/action-versioning.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/action-versioning.md b/docs/action-versioning.md index 4a8e8168..39a9be98 100644 --- a/docs/action-versioning.md +++ b/docs/action-versioning.md @@ -17,13 +17,13 @@ Binding to a major version is the latest of that major version ( e.g. `v1` == "1 Major versions should guarantee compatibility. A major version can add net new capabilities but should not break existing input compatibility or break existing workflows. -Major version binding allows you to take advantage of bug fixes and critical functionality and security fixes. The `master` branch has the latest code and is unstable to bind to since changes get committed to master and released to the market place by creating a tag. In addition, a new major version carrying breaking changes will get implemented in master after branching off the previous major version. +Major version binding allows you to take advantage of bug fixes and critical functionality and security fixes. The `main` branch has the latest code and is unstable to bind to since changes get committed to `main` and released to the market place by creating a tag. In addition, a new major version carrying breaking changes will get implemented in `main` after branching off the previous major version. -> Warning: do not reference `master` since that is the latest code and can be carrying breaking changes of the next major version. +> Warning: do not reference `main` since that is the latest code and can be carrying breaking changes of the next major version. ```yaml steps: - - uses: actions/javascript-action@master # do not do this + - uses: actions/javascript-action@main # do not do this ``` Binding to the immutable full sha1 may offer more reliability. However, note that the hosted images toolsets (e.g. ubuntu-latest) move forward and if there is a tool breaking issue, actions may react with a patch to a major version to compensate so binding to a specific SHA may prevent you from getting fixes. From e9c6ee99a59ec34586d4374b68efe5cabfcee9db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Linus=20Unneb=C3=A4ck?= Date: Wed, 28 Apr 2021 20:24:23 +0200 Subject: [PATCH 2/4] Simplify mkdirP implementation (#444) --- packages/io/__tests__/io.test.ts | 26 ------------------ packages/io/src/io-util.ts | 47 -------------------------------- packages/io/src/io.ts | 4 ++- 3 files changed, 3 insertions(+), 74 deletions(-) diff --git a/packages/io/__tests__/io.test.ts b/packages/io/__tests__/io.test.ts index 76d07f5b..714716e7 100644 --- a/packages/io/__tests__/io.test.ts +++ b/packages/io/__tests__/io.test.ts @@ -3,7 +3,6 @@ import {promises as fs} from 'fs' import * as os from 'os' import * as path from 'path' import * as io from '../src/io' -import * as ioUtil from '../src/io-util' describe('cp', () => { it('copies file with no flags', async () => { @@ -813,31 +812,6 @@ describe('mkdirP', () => { (await fs.lstat(path.join(realDirPath, 'sub_dir'))).isDirectory() ).toBe(true) }) - - it('breaks if mkdirP loop out of control', async () => { - const testPath = path.join( - getTestTemp(), - 'mkdirP_failsafe', - '1', - '2', - '3', - '4', - '5', - '6', - '7', - '8', - '9', - '10' - ) - - expect.assertions(1) - - try { - await ioUtil.mkdirP(testPath, 10) - } catch (err) { - expect(err.code).toBe('ENOENT') - } - }) }) describe('which', () => { diff --git a/packages/io/src/io-util.ts b/packages/io/src/io-util.ts index f9775217..98d70429 100644 --- a/packages/io/src/io-util.ts +++ b/packages/io/src/io-util.ts @@ -1,4 +1,3 @@ -import {ok} from 'assert' import * as fs from 'fs' import * as path from 'path' @@ -59,52 +58,6 @@ export function isRooted(p: string): boolean { return p.startsWith('/') } -/** - * Recursively create a directory at `fsPath`. - * - * This implementation is optimistic, meaning it attempts to create the full - * path first, and backs up the path stack from there. - * - * @param fsPath The path to create - * @param maxDepth The maximum recursion depth - * @param depth The current recursion depth - */ -export async function mkdirP( - fsPath: string, - maxDepth: number = 1000, - depth: number = 1 -): Promise { - ok(fsPath, 'a path argument must be provided') - - fsPath = path.resolve(fsPath) - - if (depth >= maxDepth) return mkdir(fsPath) - - try { - await mkdir(fsPath) - return - } catch (err) { - switch (err.code) { - case 'ENOENT': { - await mkdirP(path.dirname(fsPath), maxDepth, depth + 1) - await mkdir(fsPath) - return - } - default: { - let stats: fs.Stats - - try { - stats = await stat(fsPath) - } catch (err2) { - throw err - } - - if (!stats.isDirectory()) throw err - } - } - } -} - /** * Best effort attempt to determine whether a file exists and is executable. * @param filePath file path to check diff --git a/packages/io/src/io.ts b/packages/io/src/io.ts index d6649945..870ab741 100644 --- a/packages/io/src/io.ts +++ b/packages/io/src/io.ts @@ -1,3 +1,4 @@ +import {ok} from 'assert' import * as childProcess from 'child_process' import * as path from 'path' import {promisify} from 'util' @@ -161,7 +162,8 @@ export async function rmRF(inputPath: string): Promise { * @returns Promise */ export async function mkdirP(fsPath: string): Promise { - await ioUtil.mkdirP(fsPath) + ok(fsPath, 'a path argument must be provided') + await ioUtil.mkdir(fsPath, {recursive: true}) } /** From dc8e2904053bb2030162c6a6e4df4fce14dd18bd Mon Sep 17 00:00:00 2001 From: Federico Grandi Date: Mon, 24 May 2021 16:23:40 +0200 Subject: [PATCH 3/4] docs(README): fix minor formatting issue (#819) --- packages/core/README.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/core/README.md b/packages/core/README.md index 95428cf3..c1a16abd 100644 --- a/packages/core/README.md +++ b/packages/core/README.md @@ -62,11 +62,10 @@ catch (err) { // setFailed logs the message and sets a failing exit code core.setFailed(`Action failed with error ${err}`); } +``` Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned. -``` - #### Logging Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs). From 2f164000dcd42fb08287824a3bc3030dbed33687 Mon Sep 17 00:00:00 2001 From: Josh Soref <2119212+jsoref@users.noreply.github.com> Date: Tue, 25 May 2021 14:28:45 -0400 Subject: [PATCH 4/4] Fix debug logging link (#820) --- docs/problem-matchers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/problem-matchers.md b/docs/problem-matchers.md index f8867849..eea10036 100644 --- a/docs/problem-matchers.md +++ b/docs/problem-matchers.md @@ -124,6 +124,6 @@ Use ECMAScript regular expression syntax when testing patterns. ### File property getting dropped -[Enable debug logging](https://help.github.com/en/actions/configuring-and-managing-workflows/managing-a-workflow-run#enabling-debug-logging) to determine why the file is getting dropped. +[Enable debug logging](https://docs.github.com/en/actions/managing-workflow-runs/enabling-debug-logging) to determine why the file is getting dropped. This usually happens when the file does not exist or is not under the workflow repo.