Add multi platform action source

This commit is contained in:
Peter Evans 2019-09-25 09:14:38 +09:00
parent 39529236f7
commit 8023b7d225
4 changed files with 70 additions and 0 deletions

5
action.yml Normal file
View file

@ -0,0 +1,5 @@
name: 'Create Pull Request'
description: 'Creates a pull request for changes to your repository in the actions workspace'
runs:
using: 'node12'
main: 'index.js'

25
index.js Normal file
View file

@ -0,0 +1,25 @@
const core = require('@actions/core');
const exec = require('@actions/exec');
const os = require('os');
async function run() {
try {
core.info(`platform: ${os.platform()}`)
core.info(`action directory: ${__dirname}`)
if (os.platform() == 'linux') {
await exec.exec('sudo apt-get install python3-setuptools');
}
await exec.exec(`pip3 install --requirement ${__dirname}/requirements.txt`);
if (os.platform() == 'win32') {
await exec.exec(`python ${__dirname}/create-pull-request.py`);
} else {
await exec.exec(`python3 ${__dirname}/create-pull-request.py`);
}
}
catch (error) {
core.setFailed(error.message);
}
}
run()

18
package-lock.json generated Normal file
View file

@ -0,0 +1,18 @@
{
"name": "create-pull-request",
"version": "1.2.1",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"@actions/core": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.1.tgz",
"integrity": "sha512-O5G6EmlzTVsng7VSpNtszIoQq6kOgMGNTFB/hmwKNNA4V71JyxImCIrL27vVHCt2Cb3ImkaCr6o27C2MV9Ylwg=="
},
"@actions/exec": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.1.tgz",
"integrity": "sha512-nvFkxwiicvpzNiCBF4wFBDfnBvi7xp/as7LE1hBxBxKG2L29+gkIPBiLKMVORL+Hg3JNf07AKRfl0V5djoypjQ=="
}
}
}

22
package.json Normal file
View file

@ -0,0 +1,22 @@
{
"name": "create-pull-request",
"version": "1.2.1",
"description": "Creates a pull request for changes to your repository in the actions workspace",
"main": "index.js",
"repository": {
"type": "git",
"url": "git+https://github.com/peter-evans/create-pull-request.git"
},
"keywords": [
"GitHub",
"Actions",
"Pull Request"
],
"author": "Peter Evans",
"license": "MIT",
"homepage": "https://github.com/peter-evans/create-pull-request",
"dependencies": {
"@actions/core": "^1.1.1",
"@actions/exec": "^1.0.1"
}
}