chore(deps): bump fastapi from 0.140.0 to 0.140.7 in /python #210
Workflow file for this run
This file contains hidden or 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
| name: "Project Automation" | |
| on: | |
| issues: | |
| types: [opened, reopened] | |
| pull_request: | |
| 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" | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: "Assign and Add to Project" | |
| run: | | |
| REPO="${{ github.repository }}" | |
| TOKEN="${{ secrets.GH_PROJECT_TOKEN }}" | |
| # Nota: i workflow attivati da Dependabot ricevono SOLO i Dependabot secrets. | |
| # GH_PROJECT_TOKEN deve essere registrato anche in Settings > Secrets > Dependabot. | |
| if [ -z "$TOKEN" ]; then | |
| echo "::error::GH_PROJECT_TOKEN is empty. If this run was triggered by Dependabot (actor: ${{ github.actor }}), register the same token as a Dependabot secret: Settings > Secrets and variables > Dependabot." | |
| exit 1 | |
| fi | |
| # 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 "::error::Failed to add Issue #$ISSUE_NUM to Project" | |
| echo " Details: $(echo "$RESPONSE" | jq '.errors // .message')" | |
| exit 1 | |
| fi | |
| fi | |
| # 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\":[\"${{ env.ASSIGNEE }}\"]}" \ | |
| "https://api.github.com/repos/$REPO/issues/$PR_NUM" > /dev/null | |
| echo " Assigned" | |
| # 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 "::error::Failed to add PR #$PR_NUM to Project" | |
| echo " Details: $(echo "$RESPONSE" | jq '.errors // .message')" | |
| exit 1 | |
| 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 | |
| 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 | |
| - name: "Workflow Summary" | |
| if: always() | |
| run: | | |
| echo "Project automation completed" | |
| echo "Project ID: ${{ env.PROJECT_ID }}" | |
| echo "Assignee: ${{ env.ASSIGNEE }}" |