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 | ||
| ITEM_NODE_ID: | ||
| description: "The issue or PR's graphQL node ID" | ||
| type: string | ||
| required: true | ||
| secrets: | ||
| ADD_TO_PROJECT_GITHUB_TOKEN: | ||
| description: "Project Access Token" | ||
| required: true | ||
| outputs: | ||
| ITEM_PROJECT_ID: | ||
| description: "The item's project-specific ID" | ||
| value: ${{ jobs.get_items_project_id.outputs.ITEM_PROJECT_ID }} | ||
| jobs: | ||
| get_items_project_id: | ||
| runs-on: ubuntu-latest | ||
| outputs: | ||
| ITEM_PROJECT_ID: ${{ steps.get_item_id.outputs.ITEM_PROJECT_ID }} | ||
| steps: | ||
| - name: Sleep 10s | ||
| id: sleep | ||
| run: | | ||
| # Ensure the PR is added to the project before we query its ID | ||
| # This is a workaround for the fact that the PR is not immediately added to the project | ||
| # Previously it was ~3s but that didn't guarantee the PR was added to the project | ||
| sleep 10 | ||
| - name: Get Item Project ID | ||
| id: get_item_id | ||
| env: | ||
| GH_TOKEN: ${{ secrets.ADD_TO_PROJECT_GITHUB_TOKEN }} | ||
| ENV_ITEM_NODE_ID: ${{ inputs.ITEM_NODE_ID }} | ||
| ENV_PROJECT_ID: ${{ inputs.PROJECT_ID }} | ||
| run: | | ||
| # Query up to 10 projects for the PR | ||
| # There's no graphQL filter configured to query by a specific project | ||
| # So we need to query all projects and filter the result ourselves | ||
| <<<<<<< HEAD | ||
| # shellcheck disable=SC2016 | ||
| gh api graphql -F nodeId="$ENV_ITEM_NODE_ID" -f query=' | ||
| ======= | ||
| gh api graphql -f nodeId="$ENV_ITEM_NODE_ID" -f query=' | ||
| >>>>>>> 861fe12 (Replace all `-F` usage with `-f`) | ||
| query($nodeId: ID!) { | ||
| node(id: $nodeId) { | ||
| ... on PullRequest { | ||
| projectItems(first: 10) { | ||
| nodes { | ||
| id | ||
| project { | ||
| id | ||
| } | ||
| } | ||
| } | ||
| } | ||
| ... on Issue { | ||
| projectItems(first: 10) { | ||
| nodes { | ||
| id | ||
| project { | ||
| id | ||
| } | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }' > project_data.json | ||
| # Use jq to do the actual filtering, using --arg for safe variable passing | ||
| item_project_id=$(jq --arg project_id "${ENV_PROJECT_ID}" -r '.data.node.projectItems.nodes[] | | ||
| select(.project.id == $project_id) | | ||
| .id' project_data.json) | ||
| echo "ITEM_PROJECT_ID=${item_project_id}" >> "${GITHUB_OUTPUT}" | ||
| continue-on-error: true | ||