-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Bring back pr actions #6894
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
Bring back pr actions #6894
Conversation
I like it! For user checks, you'd have to add this to all actions, or similar:
|
I'll try to incorporate that, thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
approving with the two permission updates above
@svrnm now that you have a safe way to do this, what do you think of running this (or at least the most common ones?) on every PR build and automatically applying it? (not waiting for someone to add the comment) |
just saw your slack comment, which makes sense why you don't want to do this:
|
@trask The rerun action one would likely come after this one! |
Yeah, and thinking about it, there is actually another reason why we don't want to do that: some people update their PRs with lots of small commits, so I am not sure how this would behave, i.e. would we have a flooded action pipeline? |
If we're aiming to streamline the PR process for 80% the cases, I'd be willing to give this a try. Often, drive-by PRs need either Anyhow, let's get this merged first and see if the old |
.github/workflows/pr-actions.yml
Outdated
|
||
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 | ||
with: | ||
ref: refs/pull/${{ github.event.issue.number }}/head |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the git push
below is going to fail, because this is read-only: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally#error-failed-to-push-some-refs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good find! Previously we had a separate step checking out the branch, maybe we need to bring that back
heads up, CodeQL is complaining security flaws in my PR where I'm testing out this approach: open-telemetry/opentelemetry-java-instrumentation#13872 I'm working through them now to understand and hopefully address... |
I tested the command in my own repo, it worked for |
@trask - anything left to do before we can merge and test? |
Signed-off-by: svrnm <[email protected]>
Co-authored-by: Trask Stalnaker <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it can be simplified, but have no issue with this being merged as-is
with: | ||
fetch-depth: 999 | ||
|
||
- run: gh pr checkout $PR_NUM -b "pr-action-${RANDOM}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this simplifies things, because then you can just git push
at the end (see below)
- run: gh pr checkout $PR_NUM -b "pr-action-${RANDOM}" | |
- run: gh pr checkout $PR_NUM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I remember correctly we introduced this back in the day because we had some issues with branch names that were used on the fork and upstream (think: patch-1
or similar), I could dig up the issue for that
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this simplified version is working in the (new) Java instrumentation auto apply action: https://github.com/open-telemetry/opentelemetry-java-instrumentation/blob/main/.github/workflows/auto-update-pull-request.yml
# gh pr checkout sets some git configs that we can use to make sure | ||
# we push to the right repo & to the right branch | ||
remote_repo=$(git config --get branch.${current_branch}.remote) | ||
echo remote_repo=$remote_repo | ||
remote_branch=$(git config --get branch.${current_branch}.merge) | ||
echo remote_branch=$remote_branch | ||
git commit -m "Results from /fix:${PR_ACTION}" | ||
git push ${remote_repo} HEAD:${remote_branch} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
# gh pr checkout sets some git configs that we can use to make sure | |
# we push to the right repo & to the right branch | |
remote_repo=$(git config --get branch.${current_branch}.remote) | |
echo remote_repo=$remote_repo | |
remote_branch=$(git config --get branch.${current_branch}.merge) | |
echo remote_branch=$remote_branch | |
git commit -m "Results from /fix:${PR_ACTION}" | |
git push ${remote_repo} HEAD:${remote_branch} | |
# gh pr checkout sets some git configs that we can use to make sure | |
# we push to the right repo & to the right branch | |
git commit -m "Results from /fix:${PR_ACTION}" | |
git push |
Merging. @svrnm et al. will follow through with the pending comments via another PR. Thanks all! |
Reverts #6663 with an improved workflow to run fix commands via GitHub comment:
@open-telemetry/docs-approvers @trask PTAL!
@theletterf I remember you had some code that would also check for the handle if the person is allowed to trigger the workflow (e.g. only org members, maintainers, etc.), we could add this as well.
NOTE: As always this github action has not been yet tested in full details, so unfortunately we will need to merge it at some point and then iterate on it until it works as expected.