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

Modify GraphQL query to uniquely identify issues #35

Conversation

agriyakhetarpal
Copy link
Contributor

Description

This PR updates the GraphQL search query currently being run against the GitHub API to look not just for issues by a particular creator but also to match the title in the search query.

This allows for the use of GitHub Actions variables and contexts coming from matrices or job IDs or similar in the issue, such as

issue-title: "${{ matrix.os }} did not pass"

and therefore allow the creation of and updates to issues based on these custom issue titles, and prevent updating the body of a singular issue if multiple jobs (or matrices) are being used to create issues.

What issue does this PR address?

Closes #34

Additional context

The changes can be verified in workflow runs and through the issues opened by the action on my fork, here: agriyakhetarpal#1, displaying that the proposed changes are working as usual.

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}) {
issues(first: 100, states: OPEN, filterBy: {createdBy: $creator, labels: [$label]}, orderBy: {field: CREATED_AT, direction: DESC}) {
Copy link
Contributor Author

@agriyakhetarpal agriyakhetarpal Apr 19, 2024

Choose a reason for hiding this comment

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

100 is the maximum limit for the first: query. This can potentially be reduced. However, I would still suggest keeping it to a reasonable amount, because it already has to be >1 to be able to check for titles across issues.

Since it's already running through GitHub API with ${{ github.token }}, I don't think we'll hit any rate limits.

@agriyakhetarpal
Copy link
Contributor Author

Hi, @keewis – thanks for providing the opportunity to contribute. I think this should be ready for review, so I'm tagging you here :)

@keewis
Copy link
Contributor

keewis commented Apr 19, 2024

thanks for the PR, @agriyakhetarpal. I'm somewhat busy this week so it will take me a while for a full review, but I will try to get to it as soon as possible.

@agriyakhetarpal
Copy link
Contributor Author

agriyakhetarpal commented Apr 19, 2024

No worries! I will be happy to add additional documentation about this change to the inputs in action.yaml or in the README somewhere if needed.

@keewis keewis mentioned this pull request Jul 6, 2024
1 task
@keewis
Copy link
Contributor

keewis commented Jul 6, 2024

@agriyakhetarpal, sorry for the long silence here. I've investigated the proposed fix and decided it would be easier / cleaner to use the GraphQL search connection, as that allows querying the issue title directly (the result is #38).

In any case, your implementation allowed me to skip a lot of investigation (and I'll repurpose this PR to fix the style issues).

@keewis keewis closed this in #38 Jul 7, 2024
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.

Uniquely identify existing issues by title before editing issue descriptions
2 participants