From 3679c3af4b0f60c944468d641b904e1fcdbb0c12 Mon Sep 17 00:00:00 2001 From: 0verwrite <31691645+overwrite00@users.noreply.github.com> Date: Tue, 9 Jun 2026 22:44:41 +0200 Subject: [PATCH 1/3] Add files via upload --- .github/workflows/project-automation.yml | 147 +++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 .github/workflows/project-automation.yml diff --git a/.github/workflows/project-automation.yml b/.github/workflows/project-automation.yml new file mode 100644 index 0000000..fb03eb7 --- /dev/null +++ b/.github/workflows/project-automation.yml @@ -0,0 +1,147 @@ +name: "Project Automation" + +on: + issues: + types: [opened, labeled, unlabeled] + pull_request: + types: [opened, closed, reopened, labeled, unlabeled] + pull_request_review: + types: [submitted] + workflow_run: + workflows: ["*"] + types: [completed] + +permissions: + issues: write + pull-requests: write + contents: read + +jobs: + add-to-project: + name: "Add to Project & Assign Status" + runs-on: ubuntu-latest + + steps: + - name: "Determine issue/PR type" + id: determine_type + run: | + if [ "${{ github.event_name }}" == "issues" ]; then + echo "item_type=issue" >> $GITHUB_OUTPUT + echo "item_number=${{ github.event.issue.number }}" >> $GITHUB_OUTPUT + echo "is_dependabot=false" >> $GITHUB_OUTPUT + elif [ "${{ github.event_name }}" == "pull_request" ]; then + echo "item_type=pr" >> $GITHUB_OUTPUT + echo "item_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT + if [ "${{ github.event.pull_request.user.login }}" == "dependabot[bot]" ]; then + echo "is_dependabot=true" >> $GITHUB_OUTPUT + else + echo "is_dependabot=false" >> $GITHUB_OUTPUT + fi + fi + + - name: "Add to Project (via project.json)" + if: | + github.event_name == 'issues' && github.event.action == 'opened' || + github.event_name == 'pull_request' && github.event.action == 'opened' + uses: actions/add-to-project@v0.5.0 + with: + project-url: "https://github.com/users/overwrite00/projects/3" + github-token: ${{ secrets.GITHUB_TOKEN }} + + - name: "Assign to @overwrite00" + if: | + (github.event_name == 'issues' && github.event.action == 'opened') || + (github.event_name == 'pull_request' && github.event.action == 'opened') + run: | + if [ "${{ steps.determine_type.outputs.item_type }}" == "issue" ]; then + curl -X PATCH \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github+json" \ + -d '{"assignees":["overwrite00"]}' \ + "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}" + else + curl -X PATCH \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github+json" \ + -d '{"assignees":["overwrite00"]}' \ + "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}" + fi + + - name: "Set initial status: Issue → To triage" + if: github.event_name == 'issues' && github.event.action == 'opened' + run: | + curl -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.graphql-preview+json" \ + -d '{ + "query": "mutation($projectId:ID!, $itemId:ID!) { addProjectNextItem(input: {projectId: $projectId, contentId: $itemId}) { projectNextItem { id } } }", + "variables": { + "projectId": "PVT_kwMDOC4F-84AC5Q", + "itemId": "${{ github.event.issue.node_id }}" + } + }' \ + "https://api.github.com/graphql" + + - name: "Set PR status: Manual → In progress, Dependabot → In review" + if: github.event_name == 'pull_request' && github.event.action == 'opened' + run: | + STATUS="In progress" + if [ "${{ steps.determine_type.outputs.is_dependabot }}" == "true" ]; then + STATUS="In review" + fi + + curl -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.graphql-preview+json" \ + -d "{ + \"query\": \"mutation { updateProjectNextItemField(input: {projectId: \\\"PVT_kwMDOC4F-84AC5Q\\\", itemId: \\\"${{ github.event.pull_request.node_id }}\\\", fieldId: \\\"PVTF_lADOC4F-84AC5QzHWbwA\\\", value: \\\"$STATUS\\\"}) { projectNextItem { id } } }\" + }" \ + "https://api.github.com/graphql" + + - name: "Update status on CI pass (PR)" + if: | + github.event_name == 'workflow_run' && + github.event.workflow_run.conclusion == 'success' && + github.event.workflow_run.event == 'pull_request' + run: | + echo "CI passed - would move to In review if it was in progress" + + - name: "Move to Done on merge" + if: | + github.event_name == 'pull_request' && + github.event.action == 'closed' && + github.event.pull_request.merged == true + run: | + curl -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.graphql-preview+json" \ + -d "{ + \"query\": \"mutation { updateProjectNextItemField(input: {projectId: \\\"PVT_kwMDOC4F-84AC5Q\\\", itemId: \\\"${{ github.event.pull_request.node_id }}\\\", fieldId: \\\"PVTF_lADOC4F-84AC5QzHWbwA\\\", value: \\\"Done\\\"}) { projectNextItem { id } } }\" + }" \ + "https://api.github.com/graphql" + + - name: "Auto-close linked issues" + if: | + github.event_name == 'pull_request' && + github.event.action == 'closed' && + github.event.pull_request.merged == true + run: | + # Estrai il numero dell'issue dal body della PR (Closes #123) + ISSUE_NUMBER=$(echo "${{ github.event.pull_request.body }}" | grep -oP 'Closes #\K[0-9]+' | head -1) + + if [ ! -z "$ISSUE_NUMBER" ]; then + curl -X PATCH \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github+json" \ + -d '{"state":"closed"}' \ + "https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER" + + # Sposta issue a Done nel project + curl -X POST \ + -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + -H "Accept: application/vnd.github.graphql-preview+json" \ + -d "{ + \"query\": \"mutation { updateProjectNextItemField(input: {projectId: \\\"PVT_kwMDOC4F-84AC5Q\\\", itemId: \\\"gho_issue_$ISSUE_NUMBER\\\", fieldId: \\\"PVTF_lADOC4F-84AC5QzHWbwA\\\", value: \\\"Done\\\"}) { projectNextItem { id } } }\" + }" \ + "https://api.github.com/graphql" + fi From ffc864492fa94b249cd8c109e26ed5b9d1db8791 Mon Sep 17 00:00:00 2001 From: 0verwrite <31691645+overwrite00@users.noreply.github.com> Date: Thu, 11 Jun 2026 15:22:18 +0200 Subject: [PATCH 2/3] ci: add GitHub automation configuration - Add dependabot.yml for multi-language dependency management (Python, Electron, Frontend) - Add project-automation.yml for issue/PR automation to GitHub Project - Configure labels and workflows aligned with universal schema --- .github/dependabot.yml | 96 ++++++++++ .github/workflows/project-automation.yml | 221 ++++++++++------------- 2 files changed, 195 insertions(+), 122 deletions(-) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..52544da --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,96 @@ +version: 2 +updates: + # Python backend dependencies + - package-ecosystem: "pip" + directory: "/python" + target-branch: "develop" + schedule: + interval: "weekly" + day: "monday" + time: "04:00" + timezone: "UTC" + open-pull-requests-limit: 5 + labels: + - "dependencies" + - "lang:python" + - "scope:backend" + commit-message: + prefix: "chore(deps-python)" + include: "scope" + pull-request-branch-name: + separator: "/" + allow: + - dependency-type: "all" + ignore: + - dependency-name: "*" + update-types: ["version-update:semver-major"] + + # Electron app dependencies + - package-ecosystem: "npm" + directory: "/electron" + target-branch: "develop" + schedule: + interval: "weekly" + day: "monday" + time: "04:00" + timezone: "UTC" + open-pull-requests-limit: 5 + labels: + - "dependencies" + - "lang:javascript" + - "scope:core" + commit-message: + prefix: "chore(deps-electron)" + include: "scope" + pull-request-branch-name: + separator: "/" + allow: + - dependency-type: "all" + ignore: + - dependency-name: "*" + update-types: ["version-update:semver-major"] + + # Frontend UI dependencies + - package-ecosystem: "npm" + directory: "/frontend" + target-branch: "develop" + schedule: + interval: "weekly" + day: "monday" + time: "04:00" + timezone: "UTC" + open-pull-requests-limit: 5 + labels: + - "dependencies" + - "lang:javascript" + - "scope:frontend" + commit-message: + prefix: "chore(deps-frontend)" + include: "scope" + pull-request-branch-name: + separator: "/" + allow: + - dependency-type: "all" + ignore: + - dependency-name: "*" + update-types: ["version-update:semver-major"] + + # GitHub Actions + - package-ecosystem: "github-actions" + directory: "/" + target-branch: "develop" + schedule: + interval: "weekly" + day: "monday" + time: "04:00" + timezone: "UTC" + open-pull-requests-limit: 5 + labels: + - "dependencies" + - "type:ci" + - "scope:deps" + commit-message: + prefix: "ci(deps)" + include: "scope" + pull-request-branch-name: + separator: "/" diff --git a/.github/workflows/project-automation.yml b/.github/workflows/project-automation.yml index fb03eb7..9d0949e 100644 --- a/.github/workflows/project-automation.yml +++ b/.github/workflows/project-automation.yml @@ -2,146 +2,123 @@ name: "Project Automation" on: issues: - types: [opened, labeled, unlabeled] + types: [opened, reopened] pull_request: - types: [opened, closed, reopened, labeled, unlabeled] - pull_request_review: - types: [submitted] - workflow_run: - workflows: ["*"] - types: [completed] + types: [opened, closed, reopened] permissions: issues: write pull-requests: write contents: read +env: + PROJECT_ID: "PVT_kwHOAeOTfc4BZzTY" + ASSIGNEE: "overwrite00" + jobs: add-to-project: - name: "Add to Project & Assign Status" + name: "Add to Project & Assign" runs-on: ubuntu-latest - + steps: - - name: "Determine issue/PR type" - id: determine_type + - name: "Assign and Add to Project" run: | - if [ "${{ github.event_name }}" == "issues" ]; then - echo "item_type=issue" >> $GITHUB_OUTPUT - echo "item_number=${{ github.event.issue.number }}" >> $GITHUB_OUTPUT - echo "is_dependabot=false" >> $GITHUB_OUTPUT - elif [ "${{ github.event_name }}" == "pull_request" ]; then - echo "item_type=pr" >> $GITHUB_OUTPUT - echo "item_number=${{ github.event.pull_request.number }}" >> $GITHUB_OUTPUT - if [ "${{ github.event.pull_request.user.login }}" == "dependabot[bot]" ]; then - echo "is_dependabot=true" >> $GITHUB_OUTPUT + REPO="${{ github.repository }}" + TOKEN="${{ secrets.GH_PROJECT_TOKEN }}" + + # Se Issue + if [ "${{ github.event_name }}" = "issues" ]; then + ITEM_ID="${{ github.event.issue.node_id }}" + ISSUE_NUM="${{ github.event.issue.number }}" + + echo "Processing Issue #$ISSUE_NUM..." + + # Assegna Issue + echo " - Assigning to ${{ env.ASSIGNEE }}..." + curl -s -X PATCH \ + -H "Authorization: token $TOKEN" \ + -H "Accept: application/vnd.github+json" \ + -d "{\"assignees\":[\"${{ env.ASSIGNEE }}\"]}" \ + "https://api.github.com/repos/$REPO/issues/$ISSUE_NUM" > /dev/null + echo " Assigned" + + # Aggiungi al Project + echo " - Adding to Project..." + + PAYLOAD=$(jq -n \ + --arg query 'mutation($projectId:ID!, $itemId:ID!) { addProjectV2ItemById(input: {projectId: $projectId, contentId: $itemId}) { item { id } } }' \ + --arg projectId "${{ env.PROJECT_ID }}" \ + --arg itemId "$ITEM_ID" \ + '{query: $query, variables: {projectId: $projectId, itemId: $itemId}}') + + RESPONSE=$(curl -s -X POST \ + -H "Authorization: token $TOKEN" \ + -H "Content-Type: application/json" \ + -d "$PAYLOAD" \ + "https://api.github.com/graphql") + + if echo "$RESPONSE" | jq -e '.data.addProjectV2ItemById.item.id' > /dev/null 2>&1; then + echo " Added to Project" else - echo "is_dependabot=false" >> $GITHUB_OUTPUT + echo " Failed to add to Project" + echo " Details: $(echo "$RESPONSE" | jq '.errors')" fi fi - - name: "Add to Project (via project.json)" - if: | - github.event_name == 'issues' && github.event.action == 'opened' || - github.event_name == 'pull_request' && github.event.action == 'opened' - uses: actions/add-to-project@v0.5.0 - with: - project-url: "https://github.com/users/overwrite00/projects/3" - github-token: ${{ secrets.GITHUB_TOKEN }} - - - name: "Assign to @overwrite00" - if: | - (github.event_name == 'issues' && github.event.action == 'opened') || - (github.event_name == 'pull_request' && github.event.action == 'opened') - run: | - if [ "${{ steps.determine_type.outputs.item_type }}" == "issue" ]; then - curl -X PATCH \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github+json" \ - -d '{"assignees":["overwrite00"]}' \ - "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}" - else - curl -X PATCH \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ + # Se Pull Request + if [ "${{ github.event_name }}" = "pull_request" ]; then + ITEM_ID="${{ github.event.pull_request.node_id }}" + PR_NUM="${{ github.event.pull_request.number }}" + PR_ACTION="${{ github.event.action }}" + + echo "Processing PR #$PR_NUM ($PR_ACTION)..." + + # Assegna PR + echo " - Assigning to ${{ env.ASSIGNEE }}..." + curl -s -X PATCH \ + -H "Authorization: token $TOKEN" \ -H "Accept: application/vnd.github+json" \ - -d '{"assignees":["overwrite00"]}' \ - "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.pull_request.number }}" - fi + -d "{\"assignees\":[\"${{ env.ASSIGNEE }}\"]}" \ + "https://api.github.com/repos/$REPO/issues/$PR_NUM" > /dev/null + echo " Assigned" - - name: "Set initial status: Issue → To triage" - if: github.event_name == 'issues' && github.event.action == 'opened' - run: | - curl -X POST \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github.graphql-preview+json" \ - -d '{ - "query": "mutation($projectId:ID!, $itemId:ID!) { addProjectNextItem(input: {projectId: $projectId, contentId: $itemId}) { projectNextItem { id } } }", - "variables": { - "projectId": "PVT_kwMDOC4F-84AC5Q", - "itemId": "${{ github.event.issue.node_id }}" - } - }' \ - "https://api.github.com/graphql" - - - name: "Set PR status: Manual → In progress, Dependabot → In review" - if: github.event_name == 'pull_request' && github.event.action == 'opened' - run: | - STATUS="In progress" - if [ "${{ steps.determine_type.outputs.is_dependabot }}" == "true" ]; then - STATUS="In review" + # Aggiungi al Project (solo se opened o reopened) + if [ "$PR_ACTION" = "opened" ] || [ "$PR_ACTION" = "reopened" ]; then + echo " - Adding to Project..." + + PAYLOAD=$(jq -n \ + --arg query 'mutation($projectId:ID!, $itemId:ID!) { addProjectV2ItemById(input: {projectId: $projectId, contentId: $itemId}) { item { id } } }' \ + --arg projectId "${{ env.PROJECT_ID }}" \ + --arg itemId "$ITEM_ID" \ + '{query: $query, variables: {projectId: $projectId, itemId: $itemId}}') + + RESPONSE=$(curl -s -X POST \ + -H "Authorization: token $TOKEN" \ + -H "Content-Type: application/json" \ + -d "$PAYLOAD" \ + "https://api.github.com/graphql") + + if echo "$RESPONSE" | jq -e '.data.addProjectV2ItemById.item.id' > /dev/null 2>&1; then + echo " Added to Project" + else + echo " Failed to add to Project" + echo " Details: $(echo "$RESPONSE" | jq '.errors')" + fi + fi + + # Se PR è stato chiuso + if [ "$PR_ACTION" = "closed" ]; then + echo " - PR closed" + PR_MERGED="${{ github.event.pull_request.merged }}" + if [ "$PR_MERGED" = "true" ]; then + echo " PR merged - Item will auto-transition in Project" + fi + fi fi - - curl -X POST \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github.graphql-preview+json" \ - -d "{ - \"query\": \"mutation { updateProjectNextItemField(input: {projectId: \\\"PVT_kwMDOC4F-84AC5Q\\\", itemId: \\\"${{ github.event.pull_request.node_id }}\\\", fieldId: \\\"PVTF_lADOC4F-84AC5QzHWbwA\\\", value: \\\"$STATUS\\\"}) { projectNextItem { id } } }\" - }" \ - "https://api.github.com/graphql" - - - name: "Update status on CI pass (PR)" - if: | - github.event_name == 'workflow_run' && - github.event.workflow_run.conclusion == 'success' && - github.event.workflow_run.event == 'pull_request' - run: | - echo "CI passed - would move to In review if it was in progress" - - name: "Move to Done on merge" - if: | - github.event_name == 'pull_request' && - github.event.action == 'closed' && - github.event.pull_request.merged == true + - name: "Workflow Summary" + if: always() run: | - curl -X POST \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github.graphql-preview+json" \ - -d "{ - \"query\": \"mutation { updateProjectNextItemField(input: {projectId: \\\"PVT_kwMDOC4F-84AC5Q\\\", itemId: \\\"${{ github.event.pull_request.node_id }}\\\", fieldId: \\\"PVTF_lADOC4F-84AC5QzHWbwA\\\", value: \\\"Done\\\"}) { projectNextItem { id } } }\" - }" \ - "https://api.github.com/graphql" - - - name: "Auto-close linked issues" - if: | - github.event_name == 'pull_request' && - github.event.action == 'closed' && - github.event.pull_request.merged == true - run: | - # Estrai il numero dell'issue dal body della PR (Closes #123) - ISSUE_NUMBER=$(echo "${{ github.event.pull_request.body }}" | grep -oP 'Closes #\K[0-9]+' | head -1) - - if [ ! -z "$ISSUE_NUMBER" ]; then - curl -X PATCH \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github+json" \ - -d '{"state":"closed"}' \ - "https://api.github.com/repos/${{ github.repository }}/issues/$ISSUE_NUMBER" - - # Sposta issue a Done nel project - curl -X POST \ - -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ - -H "Accept: application/vnd.github.graphql-preview+json" \ - -d "{ - \"query\": \"mutation { updateProjectNextItemField(input: {projectId: \\\"PVT_kwMDOC4F-84AC5Q\\\", itemId: \\\"gho_issue_$ISSUE_NUMBER\\\", fieldId: \\\"PVTF_lADOC4F-84AC5QzHWbwA\\\", value: \\\"Done\\\"}) { projectNextItem { id } } }\" - }" \ - "https://api.github.com/graphql" - fi + echo "Project automation completed" + echo "Project ID: ${{ env.PROJECT_ID }}" + echo "Assignee: ${{ env.ASSIGNEE }}" From dd10903bf4817031ccfc657ee785df95965d659d Mon Sep 17 00:00:00 2001 From: 0verwrite <31691645+overwrite00@users.noreply.github.com> Date: Thu, 11 Jun 2026 15:49:18 +0200 Subject: [PATCH 3/3] feat: add automatic reviewer request to workflow - Request @overwrite00 as reviewer on opened/reopened PRs - Works alongside automatic assignment to streamline PR review process --- .github/workflows/project-automation.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/project-automation.yml b/.github/workflows/project-automation.yml index 9d0949e..0534276 100644 --- a/.github/workflows/project-automation.yml +++ b/.github/workflows/project-automation.yml @@ -104,6 +104,15 @@ jobs: echo " Failed to add to Project" echo " Details: $(echo "$RESPONSE" | jq '.errors')" fi + + # Richiedi reviewer + echo " - Requesting reviewer..." + curl -s -X POST \ + -H "Authorization: token $TOKEN" \ + -H "Accept: application/vnd.github+json" \ + -d "{\"reviewers\":[\"${{ env.ASSIGNEE }}\"]}" \ + "https://api.github.com/repos/$REPO/pulls/$PR_NUM/requested_reviewers" > /dev/null + echo " Reviewer requested" fi # Se PR è stato chiuso