Finish implementing the tagExists action helper script

This commit is contained in:
Oliver 2025-11-16 01:48:22 -07:00
parent 58893f46db
commit 6df0780676

View file

@ -1,11 +1,28 @@
import axios from "axios";
const {
TAG_NAME,
FORGEJO_API_URL,
FORGEJO_REPOSITORY,
FORGEJO_REPOSITORY_OWNER,
FORGEJO_API_URL: API_URL,
FORGEJO_REPOSITORY: REPO,
FORGEJO_TOKEN: TOKEN,
} = 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,
},
);
// We actually *want* an error when the tag exists, instead of when
// it doesn't
if (response.status === 200) {
process.exit(1);
};
};
main();