Data Request API helper #10

Merged
Oliver merged 94 commits from feat/data-requests into main 2025-11-22 02:51:15 +00:00
Showing only changes of commit 6df0780676 - Show all commits

View file

@ -1,11 +1,28 @@
import axios from "axios";
const { const {
TAG_NAME, TAG_NAME,
FORGEJO_API_URL, FORGEJO_API_URL: API_URL,
FORGEJO_REPOSITORY, FORGEJO_REPOSITORY: REPO,
FORGEJO_REPOSITORY_OWNER, FORGEJO_TOKEN: TOKEN,
} = process.env; } = process.env;
async function main() {
const requestURL = `${API_URL}/repos/${REPO}/tags/${TAG_NAME}`;
console.log(process.env) const response = await axios.get(
requestURL,
{
headers: { Authorization: `token ${TOKEN}` },
validateStatus: () => true,
},
);
process.exit(1); // We actually *want* an error when the tag exists, instead of when
// it doesn't
if (response.status === 200) {
process.exit(1);
};
};
main();