Skip to content

Commit a10eefa

Browse files
author
Danny McCormick
committed
Initial commit
0 parents  commit a10eefa

17 files changed

+219
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
package-lock.json
2+
node_modules

.prettierrc.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"printWidth": 80,
3+
"tabWidth": 2,
4+
"useTabs": false,
5+
"semi": true,
6+
"singleQuote": true,
7+
"trailingComma": "none",
8+
"bracketSpacing": false,
9+
"arrowParens": "avoid",
10+
"parser": "typescript"
11+
}

Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
FROM node:slim
2+
3+
COPY . .
4+
5+
RUN npm install --production
6+
7+
ENTRYPOINT ["node", "/lib/main.js"]

LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
The MIT License (MIT)
3+
4+
Copyright (c) 2018 GitHub, Inc. and contributors
5+
6+
Permission is hereby granted, free of charge, to any person obtaining a copy
7+
of this software and associated documentation files (the "Software"), to deal
8+
in the Software without restriction, including without limitation the rights
9+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
copies of the Software, and to permit persons to whom the Software is
11+
furnished to do so, subject to the following conditions:
12+
13+
The above copyright notice and this permission notice shall be included in
14+
all copies or substantial portions of the Software.
15+
16+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
THE SOFTWARE.

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Container Action Template
2+
3+
To get started, click the `Use this template` button on this repository [which will create a new repository based on this template](https://github.blog/2019-06-06-generate-new-repositories-with-repository-templates/).

__tests__/main.test.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
describe('TODO - Add a test suite', () => {
2+
it('TODO - Add a test', async () => {
3+
});
4+
});

action.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: 'Container Action Template'
2+
description: 'Get started with Container actions'
3+
author: 'GitHub'
4+
inputs:
5+
myInput:
6+
description: 'Input to use'
7+
default: 'world'
8+
runs:
9+
using: 'docker'
10+
image: 'Dockerfile'

jest.config.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
module.exports = {
2+
clearMocks: true,
3+
moduleFileExtensions: ['js', 'ts'],
4+
testEnvironment: 'node',
5+
testMatch: ['**/*.test.ts'],
6+
testRunner: 'jest-circus/runner',
7+
transform: {
8+
'^.+\\.ts$': 'ts-jest'
9+
},
10+
verbose: true
11+
}

lib/main.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
"use strict";
2+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3+
return new (P || (P = Promise))(function (resolve, reject) {
4+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
7+
step((generator = generator.apply(thisArg, _arguments || [])).next());
8+
});
9+
};
10+
const core = require('@actions/core');
11+
const github = require('@actions/github');
12+
function run() {
13+
return __awaiter(this, void 0, void 0, function* () {
14+
try {
15+
const myInput = core.getInput('myInput');
16+
core.debug(`Hello ${myInput} from inside a container`);
17+
// Get github context data
18+
const context = github.context;
19+
console.log(`We can even get context data, like the repo: ${context.repo.repo}`);
20+
}
21+
catch (error) {
22+
core.setFailed(error.message);
23+
}
24+
});
25+
}
26+
run();

package.json

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
{
2+
"name": "container-toolkit-template",
3+
"version": "0.0.0",
4+
"description": "Container template action using actions/toolkit",
5+
"main": "lib/main.js",
6+
"scripts": {
7+
"build": "tsc",
8+
"format": "prettier --write **/*.ts",
9+
"test": "jest"
10+
},
11+
"repository": {
12+
"type": "git",
13+
"url": "git+https://github.com/actions/container-toolkit-template.git"
14+
},
15+
"keywords": [
16+
"actions",
17+
"container",
18+
"toolkit",
19+
"setup"
20+
],
21+
"author": "GitHub",
22+
"license": "ISC",
23+
"bugs": {
24+
"url": "https://github.com/actions/container-toolkit-template/issues"
25+
},
26+
"homepage": "https://github.com/actions/container-toolkit-template#readme",
27+
"dependencies": {
28+
"@actions/core": "file:toolkit/actions-core-0.0.0.tgz",
29+
"@actions/io": "file:toolkit/actions-io-0.0.0.tgz",
30+
"@actions/exec": "file:toolkit/actions-exec-0.0.0.tgz",
31+
"@actions/github": "file:toolkit/actions-github-0.0.0.tgz",
32+
"@actions/tool-cache": "file:toolkit/actions-tool-cache-0.0.0.tgz"
33+
},
34+
"devDependencies": {
35+
"@types/jest": "^24.0.13",
36+
"@types/node": "^12.0.4",
37+
"jest": "^24.8.0",
38+
"jest-circus": "^24.7.1",
39+
"prettier": "^1.17.1",
40+
"ts-jest": "^24.0.2",
41+
"typescript": "^3.5.1"
42+
}
43+
}

0 commit comments

Comments
 (0)