-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 57832ea
Showing
368 changed files
with
88,653 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Directory push/pop action | ||
|
||
This action moves the named directory (if it exists) out of the specified cache directory into the (optionally specified) destination directory. If the destination is not specified, it defaults to `$GITHUB_WORKSPACE`. | ||
|
||
When the job that uses this action ends, the action moves the directory back to the cache directory. | ||
|
||
## Inputs | ||
|
||
### `cacheDirectory` | ||
|
||
**Required** Path to the directory used to store directories | ||
|
||
### `namedDirectory` | ||
|
||
**Required** Name of the directory to move | ||
|
||
### `destinationDirectory` | ||
|
||
Where to move the named directory to | ||
|
||
## Example usage | ||
|
||
```yaml | ||
uses: linaro-its/directory-push-pop@v1 | ||
with: | ||
cacheDirectory: /srv/cache | ||
namedDirectory: $SITE_URL | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
name: Directory push/pop | ||
author: Philip Colmer (Linaro Ltd) | ||
branding: | ||
icon: "archive" | ||
color: "green" | ||
description: | | ||
By using a nominated cache directory, this action moves a named directory | ||
out of the cache into the specified destination directory (default is | ||
$GITHUB_WORKSPACE) and then, after the job finishes, moves it back. | ||
inputs: | ||
cacheDirectory: | ||
description: "Path to the directory used to store directories" | ||
required: true | ||
namedDirectory: | ||
description: "Name of the directory to move" | ||
required: true | ||
destinationDirectory: | ||
description: "Where to move the named directory to" | ||
required: false | ||
runs: | ||
using: "node12" | ||
main: 'directory-out.js' | ||
post: 'directory-in.js' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Reverses what directory-out did, namely moving the | ||
// named directory out of the destination directory back | ||
// into the cache directory. | ||
const core = require('@actions/core'); | ||
const fs = require('fs'); | ||
|
||
function isDirSync(aPath) { | ||
const result = fs.statSync(aPath).isDirectory(); | ||
// No error if something exists with the name so | ||
// throw an error if not a directory. | ||
if (!result) { | ||
throw `${aPath} is not a directory` | ||
} | ||
} | ||
|
||
function dirExists(aPath) { | ||
try { | ||
const result = fs.statSync(aPath).isDirectory(); | ||
if (result) { | ||
return true; | ||
} | ||
} catch (e) { | ||
return false; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
try { | ||
const cacheDirectory = core.getInput("cacheDirectory", { required: true }); | ||
const namedDirectory = core.getInput("namedDirectory", { required: true }); | ||
var destinationDirectory = core.getInput("destinationDirectory"); | ||
// If the destination directory wasn't specified, default to $GITHUB_WORKSPACE | ||
if (!destinationDirectory) { | ||
destinationDirectory = process.env["GITHUB_WORKSPACE"]; | ||
} | ||
// Check that cache and dest exist and are directories. | ||
isDirSync(cacheDirectory); | ||
isDirSync(destinationDirectory); | ||
// If the named directory exists, move it. | ||
if (dirExists(`${destinationDirectory}/${namedDirectory}`)) { | ||
fs.renameSync(`${destinationDirectory}/${namedDirectory}`, `${cacheDirectory}/${namedDirectory}`); | ||
} | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Move the named directory (if it exists) out of the cache directory | ||
// into the destination directory. | ||
const core = require('@actions/core'); | ||
const fs = require('fs'); | ||
|
||
function isDirSync(aPath) { | ||
const result = fs.statSync(aPath).isDirectory(); | ||
// No error if something exists with the name so | ||
// throw an error if not a directory. | ||
if (!result) { | ||
throw `${aPath} is not a directory` | ||
} | ||
} | ||
|
||
function dirExists(aPath) { | ||
try { | ||
const result = fs.statSync(aPath).isDirectory(); | ||
if (result) { | ||
return true; | ||
} | ||
} catch (e) { | ||
return false; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
try { | ||
const cacheDirectory = core.getInput("cacheDirectory", { required: true }); | ||
const namedDirectory = core.getInput("namedDirectory", { required: true }); | ||
var destinationDirectory = core.getInput("destinationDirectory"); | ||
// If the destination directory wasn't specified, default to $GITHUB_WORKSPACE | ||
if (!destinationDirectory) { | ||
destinationDirectory = process.env["GITHUB_WORKSPACE"]; | ||
} | ||
// Check that cache and dest exist and are directories. | ||
isDirSync(cacheDirectory); | ||
isDirSync(destinationDirectory); | ||
// If the named directory exists, move it. | ||
if (dirExists(`${cacheDirectory}/${namedDirectory}`)) { | ||
fs.renameSync(`${cacheDirectory}/${namedDirectory}`, `${destinationDirectory}/${namedDirectory}`); | ||
} | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.