Skip to content

Commit

Permalink
feat!: refactor to latest core library
Browse files Browse the repository at this point in the history
  • Loading branch information
kellertk committed Jan 30, 2025
1 parent 3754869 commit 0fb4292
Show file tree
Hide file tree
Showing 9 changed files with 358 additions and 1,265 deletions.
12 changes: 12 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org

# top-most EditorConfig file
root = true

[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
9 changes: 0 additions & 9 deletions .eslintrc.yml

This file was deleted.

6 changes: 0 additions & 6 deletions Dockerfile

This file was deleted.

8 changes: 4 additions & 4 deletions action.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# action.yml
---
name: 'Closed Issue Message'
description: 'Add a default comment on all issues that get closed'
inputs:
Expand All @@ -9,8 +9,8 @@ inputs:
description: 'The message you want to be commented whenever an issue is closed'
required: true
runs:
using: 'docker'
image: 'Dockerfile'
using: 'node20'
main: 'entrypoint.js'
branding:
icon: 'message-square'
color: 'orange'
color: 'orange'
26 changes: 26 additions & 0 deletions biome.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"formatter": {
"indentStyle": "space",
"lineWidth": 120,
"indentWidth": 2,
"lineEnding": "lf",
"enabled": true,
},
"linter": {
"enabled": true,
},
"javascript": {
"formatter": {
"trailingCommas": "all",
"jsxQuoteStyle": "double",
"quoteStyle": "single",
"bracketSpacing": true,
"arrowParentheses": "always",
},
},
"json": {
"formatter": {
"trailingCommas": "all",
},
},
}
27 changes: 27 additions & 0 deletions entrypoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import * as core from '@actions/core';
import * as github from '@actions/github';
import { exit } from 'node:process';

const token = core.getInput('repo-token', { required: true });
const octokit = github.getOctokit(token);
const message = core.getInput('message', { required: true });

const issueNumber = github.context.payload.issue?.number || github.context.payload.pull_request?.number;
if (!issueNumber) {
core.setFailed('No issue or pull request found in the context');
exit(core.ExitCode.Failure);
}

try {
await octokit.rest.issues.createComment({
...context.repo,
issue_number: issueNumber,
body: message
});
core.info(`Commented on issue #${issueNumber}`);
} catch (error) {
core.setFailed(error.message);
exit(core.ExitCode.Failure);
}

exit(core.ExitCode.Success);
Loading

0 comments on commit 0fb4292

Please sign in to comment.