generated from githubabcs/gh-abcs-actions
-
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 883d3d1
Showing
61 changed files
with
53,575 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,9 @@ | ||
FROM python:3 | ||
|
||
COPY requirements.txt ./ | ||
|
||
RUN pip install --no-cache-dir -r requirements.txt | ||
|
||
COPY . . | ||
|
||
CMD [ "python", "/src/main.py" ] |
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,11 @@ | ||
name: "my cat fact action" | ||
|
||
description: "Get external data with GitHub Actions" | ||
|
||
outputs: | ||
fact: | ||
description: Resulting cat fact from the https://cat-fact.herokuapp.com/facts api | ||
|
||
runs: | ||
using: "docker" | ||
image: "Dockerfile" |
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 @@ | ||
requests |
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,29 @@ | ||
import requests | ||
import random | ||
import sys | ||
|
||
# Make an HTTP GET request to the cat-fact API | ||
cat_url = "https://cat-fact.herokuapp.com/facts" | ||
r = requests.get(cat_url) | ||
r_obj_list = r.json() | ||
|
||
# Create an empty list to store individual facts in | ||
# This will make it easy to select a random one later | ||
fact_list = [] | ||
|
||
# Add the "text" of every object into the fact_list list | ||
for fact in r_obj_list: | ||
fact_list.append(fact["text"]) | ||
|
||
# Select a random fact from the fact_list and return it | ||
# into a variable named random_fact so we can use it | ||
def select_random_fact(fact_arr): | ||
return fact_arr[random.randint(0, len(fact_list)+1)] | ||
|
||
random_fact = select_random_fact(fact_list) | ||
|
||
# Print the individual randomly returned cat-fact | ||
print(random_fact) | ||
|
||
# Set the fact-output of the action as the value of random_fact | ||
print(f"::set-output name=fact::{random_fact}") |
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,21 @@ | ||
name: 'Hello World Composite Action' | ||
description: 'Greet someone' | ||
inputs: | ||
who-to-greet: # id of input | ||
description: 'Who to greet' | ||
required: true | ||
default: 'World' | ||
outputs: | ||
random-number: | ||
description: "Random number" | ||
value: ${{ steps.random-number-generator.outputs.random-id }} | ||
runs: | ||
using: "composite" | ||
steps: | ||
- run: echo Hello from composite action ${{ inputs.who-to-greet }}. | ||
shell: bash | ||
- id: random-number-generator | ||
run: echo "::set-output name=random-id::$(echo $RANDOM)" | ||
shell: bash | ||
- run: echo "${{ github.action_path }}" >> $GITHUB_PATH | ||
shell: bash |
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,6 @@ | ||
FROM golang:1.15 | ||
WORKDIR /go/src/hello | ||
COPY . . | ||
RUN go get -d -v ./... | ||
RUN go install -v ./... | ||
CMD ["hello"] |
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,22 @@ | ||
name: "my hello action docker" | ||
|
||
description: "say hello with GitHub Actions" | ||
|
||
inputs: | ||
firstGreeting: | ||
description: "who would you like to greet in the console" | ||
required: true | ||
default: "Hubot" | ||
|
||
secondGreeting: | ||
description: "another person to greet" | ||
required: true | ||
default: "Mona the Octocat" | ||
|
||
thirdGreeting: | ||
description: "a third greeting" | ||
required: false | ||
|
||
runs: | ||
using: "docker" | ||
image: "Dockerfile" |
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,24 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
) | ||
|
||
func main() { | ||
|
||
// Access Inputs as environment vars | ||
firstGreeting := os.Getenv("INPUT_FIRSTGREETING") | ||
secondGreeting := os.Getenv("INPUT_SECONDGREETING") | ||
thirdGreeting := os.Getenv("INPUT_THIRDGREETING") | ||
|
||
// Use those inputs in the actions logic | ||
fmt.Println("Hello " + firstGreeting) | ||
fmt.Println("Hello " + secondGreeting) | ||
|
||
// Someimes inputs are not "required" and we can build around that | ||
if thirdGreeting != "" { | ||
fmt.Println("Hello " + thirdGreeting) | ||
} | ||
|
||
} |
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,7 @@ | ||
name: "my hello action JS" | ||
|
||
description: "say hello with GitHub Actions" | ||
|
||
runs: | ||
using: "node12" | ||
main: "dist/index.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,59 @@ | ||
module.exports = | ||
/******/ (function(modules, runtime) { // webpackBootstrap | ||
/******/ "use strict"; | ||
/******/ // The module cache | ||
/******/ var installedModules = {}; | ||
/******/ | ||
/******/ // The require function | ||
/******/ function __webpack_require__(moduleId) { | ||
/******/ | ||
/******/ // Check if module is in cache | ||
/******/ if(installedModules[moduleId]) { | ||
/******/ return installedModules[moduleId].exports; | ||
/******/ } | ||
/******/ // Create a new module (and put it into the cache) | ||
/******/ var module = installedModules[moduleId] = { | ||
/******/ i: moduleId, | ||
/******/ l: false, | ||
/******/ exports: {} | ||
/******/ }; | ||
/******/ | ||
/******/ // Execute the module function | ||
/******/ var threw = true; | ||
/******/ try { | ||
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | ||
/******/ threw = false; | ||
/******/ } finally { | ||
/******/ if(threw) delete installedModules[moduleId]; | ||
/******/ } | ||
/******/ | ||
/******/ // Flag the module as loaded | ||
/******/ module.l = true; | ||
/******/ | ||
/******/ // Return the exports of the module | ||
/******/ return module.exports; | ||
/******/ } | ||
/******/ | ||
/******/ | ||
/******/ __webpack_require__.ab = __dirname + "/"; | ||
/******/ | ||
/******/ // the startup function | ||
/******/ function startup() { | ||
/******/ // Load entry module and return exports | ||
/******/ return __webpack_require__(104); | ||
/******/ }; | ||
/******/ | ||
/******/ // run startup | ||
/******/ return startup(); | ||
/******/ }) | ||
/************************************************************************/ | ||
/******/ ({ | ||
|
||
/***/ 104: | ||
/***/ (function() { | ||
|
||
console.log("Hello World"); | ||
|
||
/***/ }) | ||
|
||
/******/ }); |
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 @@ | ||
console.log("Hello World"); |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,15 @@ | ||
{ | ||
"name": "hello-world", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@actions/core": "^1.6.0" | ||
} | ||
} |
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,9 @@ | ||
FROM node:slim | ||
|
||
COPY package*.json ./ | ||
|
||
RUN npm install | ||
|
||
COPY . . | ||
|
||
CMD [ "node", "/src/index.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,22 @@ | ||
name: "issue maker" | ||
|
||
description: "create and issue with a cat fact as the body" | ||
|
||
inputs: | ||
issueTitle: | ||
description: "A name for the cat-fact issue" | ||
required: true | ||
default: "A cat fact for you" | ||
|
||
catFact: | ||
description: "the cat fact retreived from a previous action" | ||
required: true | ||
default: "Mona is an Octocat" | ||
|
||
repoToken: | ||
description: "Authentication token, use secrets.GITHUB_TOKEN" | ||
required: true | ||
|
||
runs: | ||
using: "docker" | ||
image: "Dockerfile" |
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,16 @@ | ||
{ | ||
"name": "issue-maker", | ||
"version": "1.0.0", | ||
"description": "", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
}, | ||
"keywords": [], | ||
"author": "", | ||
"license": "ISC", | ||
"dependencies": { | ||
"@actions/core": "^1.2.2", | ||
"@actions/github": "^2.1.0" | ||
} | ||
} |
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 @@ | ||
const core = require("@actions/core"); | ||
const github = require("@actions/github"); | ||
|
||
async function run() { | ||
const issueTitle = core.getInput("issueTitle"); | ||
const catFact = core.getInput("catFact"); | ||
|
||
const token = core.getInput("repoToken"); | ||
try { | ||
const octokit = new github.GitHub(token); | ||
|
||
const newIssue = await octokit.issues.create({ | ||
repo: github.context.repo.repo, | ||
owner: github.context.repo.owner, | ||
title: issueTitle, | ||
body: catFact | ||
}); | ||
} catch (error) { | ||
core.setFailed(error.message); | ||
} | ||
} | ||
|
||
run(); |
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,17 @@ | ||
name: "I have issues" | ||
|
||
description: "consume the output of the previous action and create a new issue in the repository" | ||
|
||
inputs: | ||
joke: | ||
description: "This will become the body of the created issue" | ||
issue-title: | ||
description: "Every issue needs a title, it's nice to supply one, even though you could do this dynamically within your code" | ||
default: "a joke for you" | ||
required: true | ||
repo-token: | ||
description: "Token with permissions to do repo things" | ||
|
||
runs: | ||
using: "node12" | ||
main: "dist/index.js" |
Oops, something went wrong.