Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Output Project V2 Issue Item ID #79

Merged
merged 1 commit into from
Oct 8, 2022
Merged

Conversation

parroty
Copy link
Contributor

@parroty parroty commented Oct 6, 2022

Hi 👋. How do you think about adding an output parameter for "Project V2 Item ID", which will be returned by addProjectV2ItemById function call?

Background

Change

  • Add project-v2-issue-item-id output parameter.
    • The value is retrieved from the addProjectV2ItemById call response (addProjectV2ItemById.item.id)

Example

Workflow

name: Open Issues (Sample)
on:
  workflow_dispatch:
env:
  PROJECT_NUMBER: 1
  ORGANIZATION: xxx
  REPOSITORY: yyy
jobs:
  create:
    name: Create issues
    runs-on: ubuntu-latest
    steps:
    - name: Get token
      id: get_workflow_token
      uses: peter-murray/workflow-application-token-action@v1
      with:
        application_id: ${{ secrets.APPLICATION_ID }}
        application_private_key: ${{ secrets.APPLICATION_PRIVATE_KEY }}
    - name: Create new issue
      id: create-issue
      uses: parroty/issue-bot@with-item-id
      with:
        title: "Test Title"
        body: "Test Body"
        project-v2-path: "orgs/${{ env.ORGANIZATION }}/projects/${{ env.PROJECT_NUMBER }}"
        token: ${{ steps.get_workflow_token.outputs.token }}
    - uses: titoportas/[email protected]
      with:
        project-url: "https://github.com/orgs/${{ env.ORGANIZATION }}/projects/${{ env.PROJECT_NUMBER }}"
        github-token: ${{ steps.get_workflow_token.outputs.token }}
        item-id: ${{ steps.create-issue.outputs.project-v2-issue-item-id }}
        field-keys: "Status,Component,Size"
        field-values: "Todo,Frontend,5"

Action Logs (Exerpt)

Run parroty/issue-bot@with-item-id
...

Adding issue with node ID I_kwDXIIG0F85Ta8sL to project V2 URL: orgs/xxx/projects/1
Adding issue with node ID I_kwDXIIG0F85Ta8sL to project V2 with node ID: PVT_kwXOBg-OtM4AGxgx
New issue number: 35

Previous issue number: -1

Project V2 Issue Item Id: PVTI_lAXOBg-OtM4AGxgxzgC0P1Q

Copy link
Owner

@imjohnbo imjohnbo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much! LGTM :shipit:.

TIL about https://github.com/titoportas/update-project-fields and the ability to update project fields. I'd like to investigate an approach that like for issue-bot itself, but compatibility with it and other actions via this output is a great idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants