GitHub Action to retrieve Project Next Field data for a Project (beta) owned by a User or Organization.
The Get Project Next Fields
GitHub Action was created to ease the pain of maintaining a file of constants or hardcoding values pertaining to Project Next Fields for use within a GitHub CI/CD flow.
This GitHub Action uses the GitHub GraphQL API and pagination to retrieve all Project Next Field data for a Project (beta) that is owned by a User or Organization. The action returns an easily-parseable object representing a map of all Project Next Fields for a Project (beta).
- Assumptions:
- You want to query Project Next Fields for a Project (beta) that is owned by the
gfarb
User and is assigned the number1
- You have a repository secret named
PAT
that stores a Personal Access Token scoped with the appropriate permissions
- You want to query Project Next Fields for a Project (beta) that is owned by the
- Workflow:
steps: - name: Get Project Next-Fields id: project-next-fields uses: gfarb/get-project-next-fields@0.1 with: PAT: ${{ secrets.PAT }} USER: gfarb PROJECT_NEXT_NUMBER: 1
- Assumptions:
- You want to query Project Next Fields for a Project (beta) that is owned by the
github
Organization and is assigned the number1234
- You have a repository secret named
PAT
that stores a Personal Access Token scoped with the appropriate permissions
- You want to query Project Next Fields for a Project (beta) that is owned by the
- Workflow:
steps: - name: Get Project Next-Fields id: project-next-fields uses: gfarb/get-project-next-fields@0.1 with: PAT: ${{ secrets.PAT }} ORG: github PROJECT_NEXT_NUMBER: 1234
- Assumptions:
- You want to find the
id
of asingle select
Project Next Field value for a specific project - The
PROJECT_NEXT_FIELDS
output of theGet Project Next Fields
GitHub Action step was passed as an input to your future step calledPROJECT_NEXT_FIELDS
- The Project Next Field is named
SingleSelectFieldName
and the value is namedSingleSelectField_Value1
- You want to find the
- Bash:
echo "$PROJECT_NEXT_FIELDS" | \ jq '.SingleSelectFieldName.settings.options | map(select(.name == "SingleSelectField_Value1")) | .[].id'
- JavaScript:
const selectFieldValueId = JSON.parse(core.getInput('PROJECT_NEXT_FIELDS')) .SingleSelectFieldName .settings .options .filter(fieldOption => { return fieldOption.name === 'SingleSelectField_Value1' })[0].id;
- 0.1
- Initial Release
This project is licensed under the MIT License - see the LICENSE.md file for details