-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
99 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
const axios = require('axios'); | ||
module.exports = async (req, res) => | ||
{ | ||
const { dataMode } = req.body; | ||
const token = process.env.DLBR_AUTO_GITHUB_TOKEN; | ||
const owner = 'lucastozo'; | ||
const repo = 'DemonlistBR'; | ||
const branch = 'list-changes-commits'; | ||
|
||
// Obter a lista de pull requests | ||
const { data: pullRequests } = await axios.get(`https://api.github.com/repos/${owner}/${repo}/pulls`, { | ||
headers: { | ||
'Authorization': `token ${token}` | ||
} | ||
}); | ||
|
||
// Verificar se algum pull request está aberto | ||
let title; | ||
switch (dataMode) | ||
{ | ||
case 1: | ||
title = 'List Changes'; | ||
break; | ||
case 2: | ||
title = 'Records Changes'; | ||
break; | ||
default: | ||
res.status(400).json({ message: 'Modo de dados inválido' }); | ||
return; | ||
} | ||
const openPullRequest = pullRequests.find(pr => pr.state === 'open' && pr.head.ref === branch && pr.title === title); | ||
res.status(200).json({ openPullRequest: !!openPullRequest }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function checkOpenPR(dataMode) { | ||
return fetch('/api/check-pr-api', { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
}, | ||
body: JSON.stringify({dataMode}), | ||
}) | ||
.then(response => { | ||
if (!response.ok) { | ||
return false; | ||
} | ||
return response.json(); | ||
}) | ||
.then(data => { | ||
return data.openPullRequest; | ||
}) | ||
.catch(error => { | ||
return false; | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -111,6 +111,7 @@ <h1 class="modal-title fs-5" id="send-changesLabel">Enviar mudanças</h1> | |
</div> | ||
|
||
<script src="/assets/script/sendChanges.js"></script> | ||
<script src="/assets/script/checkPR.js"></script> | ||
<script src="/assets/script/LevelData.js"></script> | ||
<script src="/assets/script/getLevelInfo.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -101,6 +101,7 @@ <h1 class="modal-title fs-5" id="send-changesLabel">Enviar mudanças</h1> | |
</div> | ||
|
||
<script src="/assets/script/sendChanges.js"></script> | ||
<script src="/assets/script/checkPR.js"></script> | ||
<script src="/assets/script/PlayerData.js"></script> | ||
<script src="/assets/script/getLevelInfo.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-C6RzsynM9kWDrMNeT87bh95OGNyZPhcTNXj1NW7RuBCsyN/o0jlpcV8Qyq46cDfL" crossorigin="anonymous"></script> | ||
|