mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-02-03 20:03:25 +01:00
* feat(workflow): add GitHub-based versions.json updater Replaces newreleases.io with direct GitHub API queries. Extracts repos from fetch_and_deploy_gh_release calls in install scripts. Runs 2x daily (06:00 and 18:00 UTC). * feat(workflow): extend version crawler with multiple sources - Method 1: fetch_and_deploy_gh_release calls (direct) - Method 2: GitHub URLs extracted from all scripts - Method 3: VM image sources (HAOS) - Method 4: Docker Hub / GHCR versions - Method 5: npm Registry versions Also tries tags fallback when no releases exist. * feat(workflow): rewrite with version-sources.json config - Generates version-sources.json with structured metadata - Each entry has: slug, type, source, script, version, date - Extracts from: fetch_and_deploy_gh_release, GitHub URLs, npm, Docker - Generates versions.json for backward compatibility - Fully automatic, no manual mapping needed * feat(workflow): add manual GitHub mappings and pveam support - Method 5: Manual GitHub mappings for 36 apt-based apps (grafana, redis, postgresql, mariadb, influxdb, etc.) - Method 6: Proxmox LXC templates (debian, ubuntu, alpine) via download.proxmox.com index - Method 7: Special sources (HAOS VM) Total coverage: ~310+ apps * feat(workflow): expand manual GitHub mappings to 75 apps Added mappings for: - Apache projects (cassandra, couchdb, guacamole, tomcat) - Media apps (tdarr, unmanic, shinobi) - DevOps (coolify, dokploy, runtipi, sonarqube) - Databases (mongodb, mysql, neo4j, rabbitmq) - And 30+ more apps Total manual mappings: 75 * feat: add manual placeholders for 34 unknown-source apps - Added 34 apps with 'manual:-' type for apps without known sources - Added manual type handler in version-fetch (returns '-' placeholder) - Added manual counter to summary output - Coverage now 100% (all 405 scripts included) Manual entries can be updated later when sources are discovered. * Refactor and update GitHub workflow files Moved several workflow files to a 'bak' backup directory and renamed 'close-ttek-issues.yaml' to 'close-tteck-issues.yaml'. Refactored 'update-versions-github.yml' to focus on extracting and updating GitHub versions, simplified the extraction logic, and updated the workflow schedule to run four times daily. Minor variable and logic improvements were made in 'close-discussion.yml'. * clean file * chore: empty versions.json for workflow test
165 lines
5.1 KiB
YAML
Generated
165 lines
5.1 KiB
YAML
Generated
name: Close Discussion on PR Merge
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
permissions:
|
|
contents: read
|
|
discussions: write
|
|
|
|
jobs:
|
|
close-discussion:
|
|
if: github.repository == 'community-scripts/ProxmoxVE'
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout Repository
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set Up Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "20"
|
|
|
|
- name: Install Dependencies
|
|
run: npm install zx @octokit/graphql
|
|
|
|
- name: Close Discussion
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
GITHUB_SHA: ${{ github.sha }}
|
|
GITHUB_REPOSITORY: ${{ github.repository }}
|
|
run: |
|
|
npx zx << 'EOF'
|
|
import { graphql } from "@octokit/graphql";
|
|
|
|
(async function () {
|
|
try {
|
|
const token = process.env.GITHUB_TOKEN;
|
|
const commitSha = process.env.GITHUB_SHA;
|
|
const [owner, repo] = process.env.GITHUB_REPOSITORY.split("/");
|
|
|
|
if (!token || !commitSha || !owner || !repo) {
|
|
console.log("Missing required environment variables.");
|
|
process.exit(1);
|
|
}
|
|
|
|
const graphqlWithAuth = graphql.defaults({
|
|
headers: { authorization: `Bearer ${token}` },
|
|
});
|
|
|
|
// Find PR from commit SHA
|
|
const searchQuery = `
|
|
query($owner: String!, $repo: String!, $sha: GitObjectID!) {
|
|
repository(owner: $owner, name: $repo) {
|
|
object(oid: $sha) {
|
|
... on Commit {
|
|
associatedPullRequests(first: 1) {
|
|
nodes {
|
|
number
|
|
body
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
const prResult = await graphqlWithAuth(searchQuery, {
|
|
owner,
|
|
repo,
|
|
sha: commitSha,
|
|
});
|
|
|
|
const pr = prResult.repository.object.associatedPullRequests.nodes[0];
|
|
if (!pr) {
|
|
console.log("No PR found for this commit.");
|
|
return;
|
|
}
|
|
|
|
const prNumber = pr.number;
|
|
const prBody = pr.body;
|
|
|
|
const match = prBody.match(/#(\d+)/);
|
|
if (!match) {
|
|
console.log("No discussion ID found in PR body.");
|
|
return;
|
|
}
|
|
|
|
const discussionNumber = match[1];
|
|
console.log(`Extracted Discussion Number: ${discussionNumber}`);
|
|
|
|
// Fetch GraphQL discussion ID
|
|
const discussionQuery = `
|
|
query($owner: String!, $repo: String!, $number: Int!) {
|
|
repository(owner: $owner, name: $repo) {
|
|
discussion(number: $number) {
|
|
id
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
let discussionQLId;
|
|
try {
|
|
const discussionResponse = await graphqlWithAuth(discussionQuery, {
|
|
owner,
|
|
repo,
|
|
number: parseInt(discussionNumber, 10),
|
|
});
|
|
|
|
discussionQLId = discussionResponse.repository.discussion.id;
|
|
if (!discussionQLId) {
|
|
console.log("Failed to fetch discussion GraphQL ID.");
|
|
return;
|
|
}
|
|
} catch (error) {
|
|
console.error("Discussion not found or error occurred while fetching discussion:", error);
|
|
return;
|
|
}
|
|
|
|
// Post comment
|
|
const commentMutation = `
|
|
mutation($discussionId: ID!, $body: String!) {
|
|
addDiscussionComment(input: { discussionId: $discussionId, body: $body }) {
|
|
comment { id body }
|
|
}
|
|
}
|
|
`;
|
|
|
|
const commentResponse = await graphqlWithAuth(commentMutation, {
|
|
discussionId: discussionQLId,
|
|
body: `Merged with PR #${prNumber}`,
|
|
});
|
|
|
|
const commentId = commentResponse.addDiscussionComment.comment.id;
|
|
if (!commentId) {
|
|
console.log("Failed to post the comment.");
|
|
return;
|
|
}
|
|
|
|
console.log(`Comment Posted Successfully! Comment ID: ${commentId}`);
|
|
|
|
// Mark comment as answer
|
|
const markAnswerMutation = `
|
|
mutation($id: ID!) {
|
|
markDiscussionCommentAsAnswer(input: { id: $id }) {
|
|
discussion { id title }
|
|
}
|
|
}
|
|
`;
|
|
|
|
await graphqlWithAuth(markAnswerMutation, { id: commentId });
|
|
|
|
console.log("Comment marked as answer successfully!");
|
|
|
|
} catch (error) {
|
|
console.error("Error:", error);
|
|
process.exit(1);
|
|
}
|
|
})();
|
|
EOF
|