Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
china-dictatorship
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ciro DURAN SANTILLI
china-dictatorship
Commits
5c678721
Commit
5c678721
authored
2 years ago
by
Ciro Santilli
Browse files
Options
Downloads
Patches
Plain Diff
working?
parent
79fc2631
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
action.js
+42
-26
42 additions, 26 deletions
action.js
with
42 additions
and
26 deletions
action.js
+
42
−
26
View file @
5c678721
...
...
@@ -189,34 +189,50 @@ try {
labels
:
Array
.
from
([...
labels
,
...
newLabels
])
})
}
const
commits
=
await
octokit
.
rest
.
repos
.
listCommits
({
owner
:
'
duty-machine
'
,
repo
:
'
news
'
,
per_page
:
1
,
})
console
.
log
(
'
commits:
'
+
require
(
'
util
'
).
inspect
(
commits
,
{
depth
:
null
}))
const
sha
=
commits
.
data
[
0
].
sha
const
commit
=
await
octokit
.
rest
.
repos
.
getCommit
({
owner
:
'
duty-machine
'
,
repo
:
'
news
'
,
ref
:
sha
,
})
console
.
log
(
'
commit:
'
+
require
(
'
util
'
).
inspect
(
commit
,
{
depth
:
null
}))
let
filename
for
(
const
file
of
commit
.
data
.
files
)
{
filename
=
file
.
filename
if
(
filename
.
startsWith
(
'
articles/
'
))
{
break
// Get the latest news from duty-machine.
{
const
commits
=
await
octokit
.
rest
.
repos
.
listCommits
({
owner
:
'
duty-machine
'
,
repo
:
'
news
'
,
per_page
:
1
,
})
console
.
log
(
'
commits:
'
+
require
(
'
util
'
).
inspect
(
commits
,
{
depth
:
null
}))
const
sha
=
commits
.
data
[
0
].
sha
const
commit
=
await
octokit
.
rest
.
repos
.
getCommit
({
owner
:
'
duty-machine
'
,
repo
:
'
news
'
,
ref
:
sha
,
})
console
.
log
(
'
commit:
'
+
require
(
'
util
'
).
inspect
(
commit
,
{
depth
:
null
}))
let
filename
for
(
const
file
of
commit
.
data
.
files
)
{
filename
=
file
.
filename
if
(
filename
.
startsWith
(
'
articles/
'
))
{
break
}
}
console
.
log
(
'
filename:
'
+
require
(
'
util
'
).
inspect
(
filename
,
{
depth
:
null
}));
const
content
=
await
octokit
.
rest
.
repos
.
getContent
({
owner
:
'
duty-machine
'
,
repo
:
'
news
'
,
ref
:
sha
,
path
:
filename
,
})
console
.
log
(
'
content:
'
+
require
(
'
util
'
).
inspect
(
content
,
{
depth
:
null
}));
contentS
=
Buffer
.
from
(
content
.
data
.
content
,
'
base64
'
).
toString
(
'
utf-8
'
)
const
lines
=
contentS
.
split
(
'
\n
'
)
const
titleAndLink
=
lines
[
2
]
const
match
=
titleAndLink
.
match
(
/
\[([^\]]
+
)\]\(([^
)
]
+
)\)
/
)
const
title
=
match
[
1
]
const
link
=
match
[
2
]
const
body
=
lines
[
5
]
const
new_issue
=
octokit
.
issues
.
create
({
owner
:
payload
.
repository
.
owner
.
login
,
repo
:
payload
.
repository
.
name
,
title
,
body
:
content
.
data
.
html_url
+
'
\n\n
'
+
link
+
'
\n\n
'
+
body
,
})
}
console
.
log
(
'
filename:
'
+
require
(
'
util
'
).
inspect
(
filename
,
{
depth
:
null
}));
const
content
=
await
octokit
.
rest
.
repos
.
getContent
({
owner
:
'
duty-machine
'
,
repo
:
'
news
'
,
ref
:
sha
,
path
:
filename
,
})
console
.
log
(
'
content:
'
+
require
(
'
util
'
).
inspect
(
content
,
{
depth
:
null
}));
}
catch
(
error
)
{
core
.
setFailed
(
error
.
message
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment