Skip to content

chore(deps-python)(deps): bump pillow from 11.2.1 to 11.3.0 in /python #19

chore(deps-python)(deps): bump pillow from 11.2.1 to 11.3.0 in /python

chore(deps-python)(deps): bump pillow from 11.2.1 to 11.3.0 in /python #19

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 }}"
# 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 " Failed to add to Project"
echo " Details: $(echo "$RESPONSE" | jq '.errors')"
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 " 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
- name: "Workflow Summary"
if: always()
run: |
echo "Project automation completed"
echo "Project ID: ${{ env.PROJECT_ID }}"
echo "Assignee: ${{ env.ASSIGNEE }}"