Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
persona
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Hexang 息壤平台
persona
Commits
c071ec5f
Commit
c071ec5f
authored
13 years ago
by
Lloyd Hilaiel
Browse files
Options
Downloads
Patches
Plain Diff
add basic authentication to assign_issue scripts. now it works fantabulously.
parent
2c46f932
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
scripts/assign_issues.js
+16
-15
16 additions, 15 deletions
scripts/assign_issues.js
with
16 additions
and
15 deletions
scripts/assign_issues.js
+
16
−
15
View file @
c071ec5f
...
...
@@ -2,19 +2,24 @@
const
https
=
require
(
'
https
'
);
var
options
=
{
host
:
'
api.github.com
'
,
port
:
443
,
path
:
'
/repos/mozilla/browserid/issues?per_page=100&assignee=none
'
};
var
people
=
[
'
lloyd
'
,
'
stomlinson
'
,
'
benadida
'
];
https
.
get
(
options
,
function
(
res
)
{
var
auth
=
process
.
env
.
AUTH
;
if
(
typeof
auth
!==
'
string
'
)
{
console
.
log
(
"
oops. define env var AUTH with '<github uname>:<github pass>'
"
);
process
.
exit
(
1
);
}
https
.
get
({
host
:
'
api.github.com
'
,
port
:
443
,
path
:
'
/repos/mozilla/browserid/issues?per_page=100&assignee=none
'
},
function
(
res
)
{
var
body
=
""
;
res
.
on
(
'
data
'
,
function
(
chunk
)
{
body
+=
chunk
;
...
...
@@ -30,7 +35,6 @@ https.get(options, function(res) {
function
processIssues
(
json
)
{
var
issues
=
JSON
.
parse
(
json
);
var
num
=
0
;
issues
=
[
issues
[
0
]];
issues
.
forEach
(
function
(
i
)
{
if
(
!
i
.
assignee
)
assignIssueTo
(
i
.
number
,
people
[
num
++
%
people
.
length
]);
});
...
...
@@ -41,19 +45,16 @@ function assignIssueTo(number, person) {
host
:
'
api.github.com
'
,
port
:
443
,
path
:
'
/repos/mozilla/browserid/issues/
'
+
number
,
method
:
'
P
ATCH
'
method
:
'
P
OST
'
};
var
req
=
https
.
request
(
options
,
function
(
res
)
{
console
.
log
(
'
STATUS:
'
+
res
.
statusCode
);
console
.
log
(
'
HEADERS:
'
+
JSON
.
stringify
(
res
.
headers
));
console
.
log
(
"
assign issue
"
,
number
,
"
to
"
,
person
,
"
-
"
,
res
.
statusCode
);
res
.
setEncoding
(
'
utf8
'
);
res
.
on
(
'
data
'
,
function
(
chunk
)
{
console
.
log
(
'
BODY:
'
+
chunk
);
});
});
var
content
=
JSON
.
stringify
({
assignee
:
person
});
req
.
setHeader
(
'
content-length
'
,
content
.
length
);
req
.
setHeader
(
'
Authorization
'
,
"
Basic
"
+
new
Buffer
(
auth
,
'
utf8
'
).
toString
(
'
base64
'
));
req
.
write
(
content
);
req
.
end
();
console
.
log
(
"
assign issue
"
,
number
,
"
to
"
,
person
);
}
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