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

Add action-pr-link feature #6694

Merged
merged 11 commits into from Jun 6, 2023
Merged

Conversation

134130
Copy link
Contributor

@134130 134130 commented May 28, 2023

@134130
Copy link
Contributor Author

134130 commented May 28, 2023

When the action is defined as check run, matchingPullRequests is missing and checkSuite > checkRuns contains some values.
Need to find the way of figure out related PR.

I think this is GitHub API's bug. The matchingPullRequests need to be always returns some values when trigger event is pull_request regardless of checkRuns existing.

@yakov116
Copy link
Member

yakov116 commented May 28, 2023

I don't understand why can you not the the pr number from the issue title?
update Readme #1

@134130
Copy link
Contributor Author

134130 commented May 28, 2023

@yakov116 That is not the PR number, The WorkflowRun Number

@yakov116
Copy link
Member

Aha, use api v3

// Impossible with v4 https://github.com/refined-github/refined-github/pull/6550#discussion_r1176346110

Copy link
Member

@fregante fregante 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 for the PR!

source/features/linkify-action.tsx Outdated Show resolved Hide resolved
source/features/linkify-action.tsx Outdated Show resolved Hide resolved
source/features/linkify-action.tsx Outdated Show resolved Hide resolved
source/features/linkify-action.tsx Outdated Show resolved Hide resolved
source/refined-github.ts Outdated Show resolved Hide resolved
source/features/linkify-action.tsx Outdated Show resolved Hide resolved
source/features/linkify-action.tsx Outdated Show resolved Hide resolved
readme.md Outdated Show resolved Hide resolved
@134130
Copy link
Contributor Author

134130 commented May 29, 2023

I found the pull_request field works correctly only on administrator of repository regardless v4 or v3.

@fregante
Copy link
Member

I found the pull_request field works correctly only on administrator of repository regardless v4 or v3.

As mentioned before, I don’t think this feature should use the API, but just the observer to alter the links adding ?pr= wherever possible. We can see how well this works and potentially add the API in a month if it brings substantial benefits.

@fregante fregante changed the title Add linkify-action which provides a link back to the PR Add action-pr-link feature May 29, 2023
@134130
Copy link
Contributor Author

134130 commented May 29, 2023

Yes I'm working with not using api call :)
Just note for future.

source/features/action-pr-link.tsx Outdated Show resolved Hide resolved
source/features/action-pr-link.tsx Outdated Show resolved Hide resolved
source/features/action-pr-link.tsx Outdated Show resolved Hide resolved
@134130 134130 marked this pull request as ready for review June 4, 2023 07:41
Copy link
Member

@fregante fregante left a comment

Choose a reason for hiding this comment

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

This is great!

One limitation I found is that GitHub does not support issues, not via pr= nor via issue=

For example this workflow runs on both, but only the PRs can be linkified: https://github.com/refined-github/refined-github/actions/workflows/labeler.yml

readme.md Outdated Show resolved Hide resolved
Co-authored-by: Federico Brigante <[email protected]>
@134130
Copy link
Contributor Author

134130 commented Jun 6, 2023

One limitation I found is that GitHub does not support issues, not via pr= nor via issue=

For example this workflow runs on both, but only the PRs can be linkified: refined-github/refined-github/actions/workflows/labeler.yml

😢 But It is awesome that we can implement this feature without calling API.
Even if with calling API, I could not find the way to get the issue which triggered the workflow.

@fregante fregante merged commit 94fcf16 into refined-github:main Jun 6, 2023
9 checks passed
@134130 134130 deleted the feature/linkify-action branch June 6, 2023 14:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

When an action has spawned from a PR, provide a link back to the PR
3 participants