Skip to content

Commit

Permalink
create status check
Browse files Browse the repository at this point in the history
* route change

* create status check
  • Loading branch information
Leonz5288 authored May 28, 2021
1 parent cce4ba4 commit e11e965
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
34 changes: 34 additions & 0 deletions .github/actions/create_status_check/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
const core = require("@actions/core");
const github = require("@actions/github");

async function run() {
try {
const [
gitHubRepoOwner,
gitHubRepoName
] = process.env.GITHUB_REPOSITORY.split("/");
const gitHubSha = process.env.GITHUB_SHA;
const gitHubToken = core.getInput("github-token");

const octokit = new github.GitHub(gitHubToken);

octokit.checks.create({
owner: gitHubRepoOwner,
repo: gitHubRepoName,
name: "Check Created by API",
head_sha: gitHubSha,
status: "completed",
conclusion: "success",
output: {
title: "Check Created by API",
summary: `# All good ![step 1](https://www.imore.com/sites/imore.com/files/styles/w1600h900crop/public/field/image/2019/07/pokemonswordshieldstartertrio.jpg "Step 1")`
}
});

core.setOutput("time", new Date().toTimeString());
} catch (error) {
core.setFailed(error.message);
}
}

run();
6 changes: 6 additions & 0 deletions .github/workflows/reply_action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@ jobs:
check_comments:
runs-on: ubuntu-latest
steps:
- name: Create Status Check
uses: ./.github/actions/create_status_check
with:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get the output time
run: echo "The time was ${{ steps.hello.outputs.time }}"
- name: Pull Request Comment Trigger
uses: Khan/[email protected]
id: check
Expand Down

0 comments on commit e11e965

Please sign in to comment.