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

Uniquely identify existing issues by title before editing issue descriptions #34

Closed
agriyakhetarpal opened this issue Apr 19, 2024 · 1 comment · Fixed by #38
Closed

Comments

@agriyakhetarpal
Copy link
Contributor

agriyakhetarpal commented Apr 19, 2024

Description

This feature request is as discussed in #2. This addition would be beneficial for cases where multiple issues are to be opened through multiple workflows or through multiple jobs in a single workflow (or through a matrix that creates those jobs). Therefore, issues can then be identified with the issue title that is being served as a user-provided input to the action, and just those issues' descriptions will be modified.

A very crude example:

on:
  schedule
  ...

jobs:
  test:
    strategy:
      matrix:
        os: [macos-13, macos-14]

    steps:
    ...
    - uses: xarray-contrib/issue-from-pytest-log
      with:
        log-path: "${{ matrix.os }} tests failed ⚠️"

will create two separate issues (this may or may not be useful, but there are other contexts such as github.ref or github.run_id that are probably useful)

Possible implementation

This section of action.yml below

// Run GraphQL query against GitHub API to find the most recent open issue used for reporting failures
const query = `query($owner:String!, $name:String!, $creator:String!, $label:String!){
repository(owner: $owner, name: $name) {
issues(first: 1, states: OPEN, filterBy: {createdBy: $creator, labels: [$label]}, orderBy: {field: CREATED_AT, direction: DESC}) {
edges {
node {
body
id
number
}
}
}
}
}`;

can be modified to run a different GraphQL query that searches for issues with the

const title = "${{ inputs.issue-title }}"

variable, and create/edit just those issues.

Additional context

N/A

@agriyakhetarpal
Copy link
Contributor Author

Alright, I implemented a solution and it can be seen here: agriyakhetarpal#1 (please read through the debugging and look through the issues on my fork for extra context)

It seems to work well – I'll clean up the changes and submit a PR here.

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