Replace all -F usage with -f
#1
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 - Get Item ID Within the Project | ||
| # This workflow gets the project-specific ID for an item within a project | ||
| # All downstream queries and mutations of fields within the project require this ID | ||
| on: | ||
| workflow_call: | ||
| inputs: | ||
| PROJECT_ID: | ||
| description: "The Project's graphQL node ID" | ||
| type: string | ||
| required: true | ||
| ITERATION_FIELD_NAME: | ||
| description: "The name of the iteration field" | ||
| type: string | ||
| required: true | ||
| ITERATION_FIELD_ID: | ||
| description: "The graphQL node ID of the iteration field" | ||
| type: string | ||
| required: true | ||
| ITEM_PROJECT_ID: | ||
| description: "The issue or PR's graphQL project-specific ID" | ||
| type: string | ||
| required: true | ||
| UPDATE_ITEM: | ||
| description: "Whether to update the item's iteration field" | ||
| default: false | ||
| type: boolean | ||
| # Optional fields, used if UPDATE_ITEM is set to true | ||
| ITEM_NODE_ID: | ||
| description: "The issue or PR's graphQL node ID, only needed if updating linked issues" | ||
| default: null | ||
| type: string | ||
| UPDATE_LINKED_ISSUES: | ||
| description: "Whether to update the linked issues' iteration fields" | ||
| default: false | ||
| type: boolean | ||
| secrets: | ||
| ADD_TO_PROJECT_GITHUB_TOKEN: | ||
| description: "Project Access Token" | ||
| required: true | ||
| outputs: | ||
| ITERATION_OPTION_ID: | ||
| value: ${{ jobs.get_set_iteration_option_id.outputs.ITERATION_OPTION_ID }} | ||
| description: "The iteration option ID" | ||
| jobs: | ||
| get_set_iteration_option_id: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| outputs: | ||
| ITERATION_OPTION_ID: ${{ steps.get_iteration_option_id.outputs.ITERATION_OPTION_ID }} | ||
| steps: | ||
| - name: Get Iteration Option ID | ||
| id: get_iteration_option_id | ||
| env: | ||
| GH_TOKEN: ${{ secrets.ADD_TO_PROJECT_GITHUB_TOKEN }} | ||
| ENV_PROJECT_ID: ${{ inputs.PROJECT_ID }} | ||
| ENV_ITERATION_FIELD_NAME: ${{ inputs.ITERATION_FIELD_NAME }} | ||
| run: | | ||
| # Get current iteration iteration id | ||
| # The current iteration is always the first element in the returned list | ||
| <<<<<<< HEAD | ||
| # shellcheck disable=SC2016 | ||
| gh api graphql -F projectId="$ENV_PROJECT_ID" -F fieldName="$ENV_ITERATION_FIELD_NAME" -f query=' | ||
| ======= | ||
| gh api graphql -f projectId="$ENV_PROJECT_ID" -f fieldName="$ENV_ITERATION_FIELD_NAME" -f query=' | ||
| >>>>>>> 861fe12 (Replace all `-F` usage with `-f`) | ||
| query($projectId: ID!, $fieldName: String!) { | ||
| node(id: $projectId) { | ||
| ... on ProjectV2 { | ||
| id | ||
| field(name: $fieldName) { | ||
| ... on ProjectV2IterationField { | ||
| id | ||
| name | ||
| configuration { | ||
| iterations { | ||
| id | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }' > iteration_option_data.json | ||
| # Use jq with --arg for safe variable handling | ||
| current_iteration_option_id=$(jq --exit-status -r '.data.node.field.configuration.iterations[0].id' iteration_option_data.json) | ||
| echo "ITERATION_OPTION_ID=$current_iteration_option_id" >> "${GITHUB_OUTPUT}" | ||
| continue-on-error: true | ||
| - name: Update item iteration field | ||
| id: update_item_iteration_field | ||
| if: ${{ inputs.UPDATE_ITEM == true }} | ||
| env: | ||
| GH_TOKEN: ${{ secrets.ADD_TO_PROJECT_GITHUB_TOKEN }} | ||
| ENV_PROJECT_ID: ${{ inputs.PROJECT_ID }} | ||
| ENV_ITEM_PROJECT_ID: ${{ inputs.ITEM_PROJECT_ID }} | ||
| ENV_ITERATION_FIELD_ID: ${{ inputs.ITERATION_FIELD_ID }} | ||
| ENV_ITERATION_OPTION_ID: ${{ steps.get_iteration_option_id.outputs.ITERATION_OPTION_ID }} | ||
| run: | | ||
| <<<<<<< HEAD | ||
| # shellcheck disable=SC2016 | ||
| gh api graphql -F projectId="$ENV_PROJECT_ID" \ | ||
| -F itemId="$ENV_ITEM_PROJECT_ID" \ | ||
| -F fieldId="$ENV_ITERATION_FIELD_ID" \ | ||
| -F iterationId="$ENV_ITERATION_OPTION_ID" \ | ||
| ======= | ||
| gh api graphql -f projectId="$ENV_PROJECT_ID" \ | ||
| -f itemId="$ENV_ITEM_PROJECT_ID" \ | ||
| -f fieldId="$ENV_ITERATION_FIELD_ID" \ | ||
| -f iterationId="$ENV_ITERATION_OPTION_ID" \ | ||
| >>>>>>> 861fe12 (Replace all `-F` usage with `-f`) | ||
| -f query=' | ||
| mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $iterationId: String!) { | ||
| updateProjectV2ItemFieldValue( | ||
| input: { | ||
| projectId: $projectId | ||
| itemId: $itemId | ||
| fieldId: $fieldId | ||
| value: { | ||
| iterationId: $iterationId | ||
| } | ||
| } | ||
| ) { | ||
| projectV2Item { | ||
| id | ||
| } | ||
| } | ||
| }' | ||
| continue-on-error: true | ||
| update_linked_issues: | ||
| if: ${{ inputs.UPDATE_LINKED_ISSUES == true }} | ||
| permissions: | ||
| contents: read | ||
| uses: ./.github/workflows/project-update-linked-issues.yaml | ||
| needs: get_set_iteration_option_id | ||
| with: | ||
| PROJECT_ID: ${{ inputs.PROJECT_ID }} | ||
| PR_PROJECT_ID: ${{ inputs.ITEM_PROJECT_ID }} | ||
| PR_NODE_ID: ${{ inputs.ITEM_NODE_ID }} | ||
| UPDATE_FIELD_TYPE: "iteration" | ||
| UPDATE_FIELD_ID: ${{ inputs.ITERATION_FIELD_ID }} | ||
| UPDATE_FIELD_VALUE: ${{ needs.get_set_iteration_option_id.outputs.ITERATION_OPTION_ID }} | ||
| secrets: inherit | ||