Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions .github/actions/issue-maker/Dockerfile
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" ]
22 changes: 22 additions & 0 deletions .github/actions/issue-maker/action.yml
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"
16 changes: 16 additions & 0 deletions .github/actions/issue-maker/package.json
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"
}
}
23 changes: 23 additions & 0 deletions .github/actions/issue-maker/src/index.js
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();
8 changes: 8 additions & 0 deletions .github/workflows/my-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ jobs:

- name: meow
uses: ./.github/actions/cat-facts
id: cat

- name: create-issue
uses: ./.github/actions/issue-maker
with:
repoToken: ${{secrets.GITHUB_TOKEN}}
catFact: ${{steps.cat.outputs.fact}}
issueTitle: "a cat fact for you"