Merge pull request #26 from camandel/add_pass_vars_pr_checkbox

projects: add checkbox to pass variables to forked PR
This commit is contained in:
Simone Gotti 2020-02-14 11:25:57 +01:00 committed by GitHub
commit 4038ec5c2a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 6 deletions

View File

@ -14,7 +14,12 @@
Private
</label>
</div>
<div class="mb-4">
<label class="checkbox">
<input type="checkbox" v-model="pass_vars_to_forked_pr" />
Pass variables to run even if triggered by PR from forked repo (DANGEROUS)
</label>
</div>
<div class="mb-3 flex items-center">
<div class="flex relative w-64">
<select
@ -165,7 +170,8 @@ export default {
this.projectName,
visibility,
remoteSource.name,
this.remoteRepoPath
this.remoteRepoPath,
this.pass_vars_to_forked_pr
);
this.stopProjectLoading();
if (error) {

View File

@ -18,6 +18,12 @@
Private
</label>
</div>
<div class="mb-4">
<label class="checkbox">
<input type="checkbox" v-model="project.pass_vars_to_forked_pr" />
Pass variables to run even if triggered by PR from forked repo (DANGEROUS)
</label>
</div>
<button class="btn btn-blue" @click="updateProject()">Update</button>
<div
v-if="updateProjectError"
@ -178,7 +184,8 @@ export default {
let { error } = await updateProject(
projectref,
this.project.name,
visibility
visibility,
this.project.pass_vars_to_forked_pr
);
if (error) {
this.updateProjectError = error;
@ -235,6 +242,7 @@ export default {
this.$store.dispatch("setError", error);
return;
}
this.project = data;
this.projectIsPrivate = this.project.visibility == "private";

View File

@ -335,6 +335,7 @@ export async function createProject(
visibility,
remotesourcename,
remoterepopath,
passvarstoforkedpr,
signal
) {
let path = "/projects";
@ -345,19 +346,21 @@ export async function createProject(
parent_ref: parentref,
visibility: visibility,
remote_source_name: remotesourcename,
repo_path: remoterepopath
repo_path: remoterepopath,
pass_vars_to_forked_pr: passvarstoforkedpr
})
};
return await fetch(apiurl(path), init, signal);
}
export async function updateProject(projectref, name, visibility, signal) {
export async function updateProject(projectref, name, visibility, passvarstoforkedpr, signal) {
let path = "/projects/" + encodeURIComponent(projectref);
let init = {
method: "PUT",
body: JSON.stringify({
name: name,
visibility: visibility
visibility: visibility,
pass_vars_to_forked_pr: passvarstoforkedpr
})
};
return await fetch(apiurl(path), init, signal);