Skip to content

Commit 74a7c2b

Browse files
committed
refactor: Add base template
1 parent 58eb8c7 commit 74a7c2b

File tree

13 files changed

+621
-0
lines changed

13 files changed

+621
-0
lines changed

.gitignore

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,76 @@ dist
102102

103103
# TernJS port file
104104
.tern-port
105+
### JetBrains template
106+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
107+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
108+
109+
# User-specific stuff
110+
.idea/**/workspace.xml
111+
.idea/**/tasks.xml
112+
.idea/**/usage.statistics.xml
113+
.idea/**/dictionaries
114+
.idea/**/shelf
115+
116+
# Generated files
117+
.idea/**/contentModel.xml
118+
119+
# Sensitive or high-churn files
120+
.idea/**/dataSources/
121+
.idea/**/dataSources.ids
122+
.idea/**/dataSources.local.xml
123+
.idea/**/sqlDataSources.xml
124+
.idea/**/dynamic.xml
125+
.idea/**/uiDesigner.xml
126+
.idea/**/dbnavigator.xml
127+
128+
# Gradle
129+
.idea/**/gradle.xml
130+
.idea/**/libraries
131+
132+
# Gradle and Maven with auto-import
133+
# When using Gradle or Maven with auto-import, you should exclude module files,
134+
# since they will be recreated, and may cause churn. Uncomment if using
135+
# auto-import.
136+
# .idea/artifacts
137+
# .idea/compiler.xml
138+
# .idea/jarRepositories.xml
139+
# .idea/modules.xml
140+
# .idea/*.iml
141+
# .idea/modules
142+
# *.iml
143+
# *.ipr
144+
145+
# CMake
146+
cmake-build-*/
147+
148+
# Mongo Explorer plugin
149+
.idea/**/mongoSettings.xml
150+
151+
# File-based project format
152+
*.iws
153+
154+
# IntelliJ
155+
out/
156+
157+
# mpeltonen/sbt-idea plugin
158+
.idea_modules/
159+
160+
# JIRA plugin
161+
atlassian-ide-plugin.xml
162+
163+
# Cursive Clojure plugin
164+
.idea/replstate.xml
165+
166+
# Crashlytics plugin (for Android Studio and IntelliJ)
167+
com_crashlytics_export_strings.xml
168+
crashlytics.properties
169+
crashlytics-build.properties
170+
fabric.properties
171+
172+
# Editor-based Rest Client
173+
.idea/httpRequests
174+
175+
# Android studio 3.1+ serialized cache file
176+
.idea/caches/build_file_checksums.ser
177+

.idea/.gitignore

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/aws.xml

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/detect-changes-action.iml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/Project_Default.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/inspectionProfiles/profiles_settings.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/misc.xml

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/modules.xml

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/vcs.xml

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

action.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
name: 'PR Metadata Action'
2+
description: 'Adds pull request file changes as a comment to a newly opened PR'
3+
inputs:
4+
paths:
5+
description: 'Paths list'
6+
required: false
7+
default: "."
8+
token:
9+
description: 'The token to use to access the GitHub API'
10+
required: true
11+
runs:
12+
using: 'node16'
13+
main: 'index.js'

index.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
const core = require('@actions/core');
2+
const github = require('@actions/github');
3+
4+
const main = async () => {
5+
try {
6+
const owner = core.getInput('paths', { required: true });
7+
const token = core.getInput('token', { required: true });
8+
const octokit = new github.getOctokit(token);
9+
10+
const { data: changedFiles } = await octokit.rest.pulls.listFiles({
11+
owner,
12+
repo,
13+
pull_number: pr_number,
14+
});
15+
16+
let diffData = {
17+
additions: 0,
18+
deletions: 0,
19+
changes: 0
20+
};
21+
22+
diffData = changedFiles.reduce((acc, file) => {
23+
acc.additions += file.additions;
24+
acc.deletions += file.deletions;
25+
acc.changes += file.changes;
26+
return acc;
27+
}, diffData);
28+
29+
console.log(changedFiles);
30+
31+
} catch (error) {
32+
core.setFailed(error.message);
33+
}
34+
}
35+
36+
main();

0 commit comments

Comments
 (0)