This commit is contained in:
santiagosayshey
2024-07-01 12:39:15 +09:30
4 changed files with 371 additions and 1 deletions

View File

@@ -0,0 +1,133 @@
name: Add Issue to Project
on:
issues:
types: [opened]
jobs:
add-to-project:
name: Add issue to project
runs-on: ubuntu-latest
steps:
- name: Add to Project
id: add-to-project
uses: actions/add-to-project@v0.5.0
with:
project-url: https://github.com/orgs/Dictionarry-Hub/projects/1
github-token: ${{ secrets.ADD_TO_PROJECT_PAT }}
- name: Get project item ID
id: get-project-item-id
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ID: "PVT_kwDOCjbMFM4AjuUh"
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: |
echo "Fetching project item ID for issue number: $ISSUE_NUMBER"
item_id=$(gh api graphql -f query='
query($project:ID!) {
node(id: $project) {
... on ProjectV2 {
items(first: 100) {
nodes {
id
content {
... on Issue {
number
}
}
}
}
}
}
}' -f project=$PROJECT_ID --jq ".data.node.items.nodes[] | select(.content.number == $ISSUE_NUMBER) | .id" -F number=$ISSUE_NUMBER)
if [ -z "$item_id" ]; then
echo "Error: Project item ID not found for issue number $ISSUE_NUMBER"
exit 1
else
echo "Project item ID found: $item_id"
echo "PROJECT_ITEM_ID=$item_id" >> $GITHUB_OUTPUT
fi
- name: Set component, type, and status
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ITEM_ID: ${{ steps.get-project-item-id.outputs.PROJECT_ITEM_ID }}
run: |
echo "Setting fields for Project Item ID: ${PROJECT_ITEM_ID}"
# Set component to "Profilarr"
result=$(gh api graphql -f query='
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $fieldId
value: {
singleSelectOptionId: $value
}
}) {
projectV2Item {
id
}
}
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="PVTSSF_lADOCjbMFM4AjuUhzgcCr_E" -f value="48fc49c7")
echo "Set component result: $result"
# Set status to "Backlog"
result=$(gh api graphql -f query='
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $fieldId
value: {
singleSelectOptionId: $value
}
}) {
projectV2Item {
id
}
}
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="PVTSSF_lADOCjbMFM4AjuUhzgcCn8s" -f value="f75ad846")
echo "Set status result: $result"
# Get the label of the issue
LABEL=$(gh api repos/${{ github.repository }}/issues/${{ github.event.issue.number }} --jq '.labels[0].name')
echo "Issue label: $LABEL"
# Convert label to lowercase for comparison
LABEL_LOWER=$(echo "$LABEL" | tr '[:upper:]' '[:lower:]')
# Set issue type based on label
ISSUE_TYPE_ID=$(case $LABEL_LOWER in
"bug") echo "b760225f" ;;
"feature request") echo "1341bde2" ;;
"improvement") echo "cb34d96f" ;;
"documentation") echo "269885d0" ;;
"refactor") echo "4996f537" ;;
"infrastructure") echo "45a91bfe" ;;
*) echo "" ;;
esac)
if [ -z "$ISSUE_TYPE_ID" ]; then
echo "No matching issue type for label: $LABEL"
else
echo "Setting issue type to ID: $ISSUE_TYPE_ID"
result=$(gh api graphql -f query='
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $fieldId
value: {
singleSelectOptionId: $value
}
}) {
projectV2Item {
id
}
}
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="PVTSSF_lADOCjbMFM4AjuUhzgcCswQ" -f value="$ISSUE_TYPE_ID")
echo "Set issue type result: $result"
fi

117
.github/workflows/add-to-testing.yml vendored Normal file
View File

@@ -0,0 +1,117 @@
name: Set Issue Status to Testing on Merge to Dev
on:
pull_request:
branches:
- dev
types:
- closed
jobs:
update-status:
if: ${{ github.event.pull_request.merged }}
runs-on: ubuntu-latest
steps:
- name: Extract Issue Number from Branch Name
id: extract-issue-number
run: |
ISSUE_NUMBER=$(echo ${{ github.event.pull_request.head.ref }} | cut -d'-' -f1)
echo "Issue Number extracted: $ISSUE_NUMBER"
echo "ISSUE_NUMBER=$ISSUE_NUMBER" >> $GITHUB_ENV
- name: Get project item ID
id: get-project-item-id
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ID: "PVT_kwDOCjbMFM4AjuUh"
run: |
echo "Fetching project item ID for issue number: $ISSUE_NUMBER"
QUERY='
query fetchProjectItem($project: ID!) {
node(id: $project) {
... on ProjectV2 {
items(first: 100) {
nodes {
id
content {
... on Issue {
number
}
}
}
}
}
}
}'
item_id=$(gh api graphql -f query="$QUERY" -f project=$PROJECT_ID --jq '.data.node.items.nodes[] | select(.content.number == '"$ISSUE_NUMBER"') | .id')
if [ -z "$item_id" ]; then
echo "Error: Project item ID not found for issue number $ISSUE_NUMBER"
exit 1
else
echo "Project item ID found: $item_id"
echo "PROJECT_ITEM_ID=$item_id" >> $GITHUB_ENV
fi
- name: Get single select field ID and options
id: get-field-options
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ID: "PVT_kwDOCjbMFM4AjuUh"
run: |
echo "Fetching field ID and options for status"
QUERY='
query($project:ID!) {
node(id: $project) {
... on ProjectV2 {
fields(first: 100) {
nodes {
... on ProjectV2SingleSelectField {
id
name
options {
id
name
}
}
}
}
}
}
}'
field_data=$(gh api graphql -f query="$QUERY" -f project=$PROJECT_ID --jq '.data.node.fields.nodes[] | select(.name == "Status")')
field_id=$(echo $field_data | jq -r '.id')
testing_option_id=$(echo $field_data | jq -r '.options[] | select(.name == "Testing") | .id')
if [ -z "$field_id" ] || [ -z "$testing_option_id" ]; then
echo "Error: Field ID or Testing option ID not found"
exit 1
else
echo "Field ID: $field_id"
echo "Testing option ID: $testing_option_id"
echo "FIELD_ID=$field_id" >> $GITHUB_ENV
echo "TESTING_OPTION_ID=$testing_option_id" >> $GITHUB_ENV
fi
- name: Set status to Testing
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ITEM_ID: ${{ env.PROJECT_ITEM_ID }}
FIELD_ID: ${{ env.FIELD_ID }}
TESTING_OPTION_ID: ${{ env.TESTING_OPTION_ID }}
run: |
echo "Setting status for Project Item ID: ${PROJECT_ITEM_ID}"
result=$(gh api graphql -f query='
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $fieldId
value: {
singleSelectOptionId: $value
}
}) {
projectV2Item {
id
}
}
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="${FIELD_ID}" -f value="${TESTING_OPTION_ID}")
echo "Set status result: $result"

114
.github/workflows/new-branch-created.yml vendored Normal file
View File

@@ -0,0 +1,114 @@
name: Update Issue Status to In Development
on:
create:
branches:
- '*-*'
jobs:
update-status:
runs-on: ubuntu-latest
steps:
- name: Extract Issue Number from Branch Name
id: extract-issue-number
run: |
ISSUE_NUMBER=$(echo $GITHUB_REF_NAME | cut -d'-' -f1)
echo "Issue Number extracted: $ISSUE_NUMBER"
echo "ISSUE_NUMBER=$ISSUE_NUMBER" >> $GITHUB_ENV
- name: Get project item ID
id: get-project-item-id
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ID: "PVT_kwDOCjbMFM4AjuUh"
run: |
echo "Fetching project item ID for issue number: $ISSUE_NUMBER"
QUERY='
query fetchProjectItem($project: ID!) {
node(id: $project) {
... on ProjectV2 {
items(first: 100) {
nodes {
id
content {
... on Issue {
number
}
}
}
}
}
}
}'
item_id=$(gh api graphql -f query="$QUERY" -f project=$PROJECT_ID --jq '.data.node.items.nodes[] | select(.content.number == '"$ISSUE_NUMBER"') | .id')
if [ -z "$item_id" ]; then
echo "Error: Project item ID not found for issue number $ISSUE_NUMBER"
exit 1
else
echo "Project item ID found: $item_id"
echo "PROJECT_ITEM_ID=$item_id" >> $GITHUB_ENV
fi
- name: Get single select field ID and options
id: get-field-options
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ID: "PVT_kwDOCjbMFM4AjuUh"
run: |
echo "Fetching field ID and options for status"
QUERY='
query($project:ID!) {
node(id: $project) {
... on ProjectV2 {
fields(first: 100) {
nodes {
... on ProjectV2SingleSelectField {
id
name
options {
id
name
}
}
}
}
}
}
}'
field_data=$(gh api graphql -f query="$QUERY" -f project=$PROJECT_ID --jq '.data.node.fields.nodes[] | select(.name == "Status")')
field_id=$(echo $field_data | jq -r '.id')
in_development_option_id=$(echo $field_data | jq -r '.options[] | select(.name == "In Development") | .id')
if [ -z "$field_id" ] || [ -z "$in_development_option_id" ]; then
echo "Error: Field ID or In Development option ID not found"
exit 1
else
echo "Field ID: $field_id"
echo "In Development option ID: $in_development_option_id"
echo "FIELD_ID=$field_id" >> $GITHUB_ENV
echo "IN_DEVELOPMENT_OPTION_ID=$in_development_option_id" >> $GITHUB_ENV
fi
- name: Set status to In Development
env:
GITHUB_TOKEN: ${{ secrets.ADD_TO_PROJECT_PAT }}
PROJECT_ITEM_ID: ${{ env.PROJECT_ITEM_ID }}
FIELD_ID: ${{ env.FIELD_ID }}
IN_DEVELOPMENT_OPTION_ID: ${{ env.IN_DEVELOPMENT_OPTION_ID }}
run: |
echo "Setting status for Project Item ID: ${PROJECT_ITEM_ID}"
result=$(gh api graphql -f query='
mutation($project:ID!, $item:ID!, $fieldId:ID!, $value:String!) {
updateProjectV2ItemFieldValue(input: {
projectId: $project
itemId: $item
fieldId: $fieldId
value: {
singleSelectOptionId: $value
}
}) {
projectV2Item {
id
}
}
}' -f project="PVT_kwDOCjbMFM4AjuUh" -f item="${PROJECT_ITEM_ID}" -f fieldId="${FIELD_ID}" -f value="${IN_DEVELOPMENT_OPTION_ID}")
echo "Set status result: $result"

View File

@@ -1,6 +1,10 @@
# Profilarr # Profilarr
Profilarr is a Python-based tool designed to add import/export/sync functionality to the \*arr suite. It offers a user-friendly way to export existing custom formats / profiles, import new ones or sync a master instance of Radarr / Sonarr with extras. Profilarr is a Python-based tool designed to add import/export/sync/delete functionality to the \*arr suite. It offers a user-friendly way to:
- Export existing custom formats / profiles
- Import new custom formats / profiles
- Sync a master instance of Radarr / Sonarr with other instances
- Delete existing custom formats / quality profiles
## Discord ## Discord
@@ -321,3 +325,5 @@ PS Z:\Profilarr>
Some custom formats found here have been interated on from the trash guides. Credit for these goes entirely to trash, and can be found on their site here. It is not my intention to steal their work, but rather to build on it and make it more accessible to the average user through my quality profiles. Please check out their site for more information on their work. Some custom formats found here have been interated on from the trash guides. Credit for these goes entirely to trash, and can be found on their site here. It is not my intention to steal their work, but rather to build on it and make it more accessible to the average user through my quality profiles. Please check out their site for more information on their work.
https://trash-guides.info/ https://trash-guides.info/
test