[READ-ONLY] Mirror of https://github.com/bombshell-dev/automation. GitHub Actions for the Bombshell organization
ci
0

Configure Feed

Select the types of activity you want to include in your feed.

feat: new move-issue-to-backlog action

Nate Moore (Dec 29, 2024, 1:31 AM -0600) 32d15dd3 9b86ad7f

+94
+94
.github/workflows/move-issue-to-backlog.yml
··· 1 + name: Move issue to backlog 2 + 3 + on: 4 + workflow_call: 5 + secrets: 6 + BOT_APP_ID: 7 + description: 'The GitHub App ID for authenticating with the GitHub API' 8 + required: true 9 + BOT_PRIVATE_KEY: 10 + description: 'The GitHub App Private Key for authenticating with the GitHub API' 11 + required: true 12 + 13 + jobs: 14 + issue: 15 + runs-on: ubuntu-latest 16 + steps: 17 + - name: Generate a token 18 + id: bot-token 19 + uses: actions/create-github-app-token@v1 20 + with: 21 + app-id: ${{ secrets.BOT_APP_ID }} 22 + private-key: ${{ secrets.BOT_PRIVATE_KEY }} 23 + 24 + - name: Get project data 25 + env: 26 + GH_TOKEN: ${{ steps.bot-token.outputs.token }} 27 + ORGANIZATION: bombshell-dev 28 + PROJECT_NUMBER: 1 29 + ISSUE_ID: ${{ github.event.issue.node_id }} 30 + run: | 31 + gh api graphql -f query=' 32 + query($org: String!, $number: Int!) { 33 + organization(login: $org){ 34 + projectV2(number: $number) { 35 + id 36 + items() { 37 + ... on ProjectV2Item { 38 + id 39 + content { 40 + id 41 + } 42 + } 43 + } 44 + fields(first:20) { 45 + nodes { 46 + ... on ProjectV2Field { 47 + id 48 + name 49 + } 50 + ... on ProjectV2SingleSelectField { 51 + id 52 + name 53 + options { 54 + id 55 + name 56 + } 57 + } 58 + } 59 + } 60 + } 61 + } 62 + }' -f org=$ORGANIZATION -F number=$PROJECT_NUMBER > project_data.json 63 + 64 + echo '$(jq '.data.organization.projectV2.items.nodes[]')' 65 + echo 'PROJECT_ID='$(jq '.data.organization.projectV2.id' project_data.json) >> $GITHUB_ENV 66 + echo 'ITEM_ID='$(jq '.data.organization.projectV2.items.nodes[] | select(.content.id=="$ISSUE_ID") | .id' project_data.json) >> $GITHUB_ENV 67 + echo 'FIELD_ID_STATUS='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") | .id' project_data.json) >> $GITHUB_ENV 68 + echo 'OPTION_ID_STATUS_BACKLOG='$(jq '.data.organization.projectV2.fields.nodes[] | select(.name== "Status") | .options[] | select(.name=="Backlog") |.id' project_data.json) >> $GITHUB_ENV 69 + 70 + - name: Set fields 71 + env: 72 + GH_TOKEN: ${{ steps.bot-token.outputs.token }} 73 + 74 + run: | 75 + gh api graphql -f query=' 76 + mutation ( 77 + $project: ID! 78 + $item: ID! 79 + $status_field: ID! 80 + $status_value: String! 81 + ) { 82 + set_status: updateProjectV2ItemFieldValue(input: { 83 + projectId: $project 84 + itemId: $item 85 + fieldId: $status_field 86 + value: { 87 + singleSelectOptionId: $status_value 88 + } 89 + }) { 90 + projectV2Item { 91 + id 92 + } 93 + } 94 + }' -f project=$PROJECT_ID -f item=$ITEM_ID -f status_field=$FIELD_ID_STATUS -f status_value=${{ env.OPTION_ID_STATUS_BACKLOG }} --silent