Skip to content

Instantly share code, notes, and snippets.

@o0h
Last active December 7, 2018 11:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save o0h/df23a37f013cce4b860b63ef00f15568 to your computer and use it in GitHub Desktop.
Save o0h/df23a37f013cce4b860b63ef00f15568 to your computer and use it in GitHub Desktop.
Travis CI API用のアクション定義
diff --git a/.github-aciton/travis-ci/.gitignore b/.github-aciton/travis-ci/.gitignore
new file mode 100644
index 0000000..ad46b30
--- /dev/null
+++ b/.github-aciton/travis-ci/.gitignore
@@ -0,0 +1,61 @@
+# Logs
+logs
+*.log
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+
+# Runtime data
+pids
+*.pid
+*.seed
+*.pid.lock
+
+# Directory for instrumented libs generated by jscoverage/JSCover
+lib-cov
+
+# Coverage directory used by tools like istanbul
+coverage
+
+# nyc test coverage
+.nyc_output
+
+# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
+.grunt
+
+# Bower dependency directory (https://bower.io/)
+bower_components
+
+# node-waf configuration
+.lock-wscript
+
+# Compiled binary addons (https://nodejs.org/api/addons.html)
+build/Release
+
+# Dependency directories
+node_modules/
+jspm_packages/
+
+# TypeScript v1 declaration files
+typings/
+
+# Optional npm cache directory
+.npm
+
+# Optional eslint cache
+.eslintcache
+
+# Optional REPL history
+.node_repl_history
+
+# Output of 'npm pack'
+*.tgz
+
+# Yarn Integrity file
+.yarn-integrity
+
+# dotenv environment variables file
+.env
+
+# next.js build output
+.next
diff --git a/.github-aciton/travis-ci/Dockerfile b/.github-aciton/travis-ci/Dockerfile
new file mode 100644
index 0000000..cf16f36
--- /dev/null
+++ b/.github-aciton/travis-ci/Dockerfile
@@ -0,0 +1,9 @@
+FROM node:10-alpine
+
+COPY package*.json /
+RUN cd / && npm install
+
+ADD create-build.js /create-build.js
+ADD entrypoint.sh /entrypoint.sh
+
+ENTRYPOINT ["/entrypoint.sh"]
diff --git a/.github-aciton/travis-ci/README b/.github-aciton/travis-ci/README
new file mode 100644
index 0000000..111a6bf
--- /dev/null
+++ b/.github-aciton/travis-ci/README
@@ -0,0 +1 @@
+https://github.com/travis-ci/actions の内容を参考にしたもの!!!
diff --git a/.github-aciton/travis-ci/create-build.js b/.github-aciton/travis-ci/create-build.js
new file mode 100644
index 0000000..f674140
--- /dev/null
+++ b/.github-aciton/travis-ci/create-build.js
@@ -0,0 +1,31 @@
+const axios = require('axios')
+
+const repository = encodeURIComponent(process.env.GITHUB_REPOSITORY)
+
+var headers = {
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Travis-API-Version': '3',
+ 'Authorization': `token ${process.env.TRAVIS_TOKEN}`
+}
+
+var body = {
+ "request": {
+ "message": "Deploy",
+ "branch": "master",
+ "config": {
+ "script": "echo 'skip!! this is release build!'"
+ }
+ }
+}
+
+axios.post(`https://api.travis-ci.com/repo/${repository}/requests`, body, { headers: headers })
+.then((res) => {
+ console.log(`statusCode: ${res.statusCode}`)
+ console.log(res)
+ process.exit()
+})
+.catch((error) => {
+ console.error(error)
+ process.exit(1)
+})
diff --git a/.github-aciton/travis-ci/entrypoint.sh b/.github-aciton/travis-ci/entrypoint.sh
new file mode 100644
index 0000000..4dc3db8
--- /dev/null
+++ b/.github-aciton/travis-ci/entrypoint.sh
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+set -e
+
+pwd
+ls -la
+
+sh -c "cd / && node create-build.js"
diff --git a/.github-aciton/travis-ci/package-lock.json b/.github-aciton/travis-ci/package-lock.json
new file mode 100644
index 0000000..c058a7d
--- /dev/null
+++ b/.github-aciton/travis-ci/package-lock.json
@@ -0,0 +1,41 @@
+{
+ "requires": true,
+ "lockfileVersion": 1,
+ "dependencies": {
+ "axios": {
+ "version": "0.18.0",
+ "resolved": "http://registry.npmjs.org/axios/-/axios-0.18.0.tgz",
+ "integrity": "sha1-MtU+SFHv3AoRmTts0AB4nXDAUQI=",
+ "requires": {
+ "follow-redirects": "^1.3.0",
+ "is-buffer": "^1.1.5"
+ }
+ },
+ "debug": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/debug/-/debug-3.1.0.tgz",
+ "integrity": "sha512-OX8XqP7/1a9cqkxYw2yXss15f26NKWBpDXQd0/uK/KPqdQhxbPa994hnzjcE2VqQpDslf55723cKPUOGSmMY3g==",
+ "requires": {
+ "ms": "2.0.0"
+ }
+ },
+ "follow-redirects": {
+ "version": "1.5.10",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.5.10.tgz",
+ "integrity": "sha512-0V5l4Cizzvqt5D44aTXbFZz+FtyXV1vrDN6qrelxtfYQKW0KO0W2T/hkE8xvGa/540LkZlkaUjO4ailYTFtHVQ==",
+ "requires": {
+ "debug": "=3.1.0"
+ }
+ },
+ "is-buffer": {
+ "version": "1.1.6",
+ "resolved": "https://registry.npmjs.org/is-buffer/-/is-buffer-1.1.6.tgz",
+ "integrity": "sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w=="
+ },
+ "ms": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
+ "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
+ }
+ }
+}
diff --git a/.github-aciton/travis-ci/package.json b/.github-aciton/travis-ci/package.json
new file mode 100644
index 0000000..8c94cff
--- /dev/null
+++ b/.github-aciton/travis-ci/package.json
@@ -0,0 +1,5 @@
+{
+ "dependencies": {
+ "axios": "^0.18.0"
+ }
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment