Skip to content

[workflows] Mention the correct user who makes a /cherry-pick comment #82680

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

Merged
merged 2 commits into from
Mar 9, 2024

Conversation

tstellar
Copy link
Collaborator

@tstellar tstellar commented Feb 22, 2024

We were mentioning the creator of the issue with the comment rather than the creator of the comment.

Fixes #82580

We were mentioning the creator of the issue with the comment rather than
the creator of the comment.
@llvmbot
Copy link
Member

llvmbot commented Feb 22, 2024

@llvm/pr-subscribers-github-workflow

Author: Tom Stellard (tstellar)

Changes

We were mentioning the creator of the issue with the comment rather than the creator of the comment.


Full diff: https://github.com/llvm/llvm-project/pull/82680.diff

1 Files Affected:

  • (modified) .github/workflows/issue-release-workflow.yml (+1-1)
diff --git a/.github/workflows/issue-release-workflow.yml b/.github/workflows/issue-release-workflow.yml
index 448c1c56f897f5..5ec2e88447e87b 100644
--- a/.github/workflows/issue-release-workflow.yml
+++ b/.github/workflows/issue-release-workflow.yml
@@ -65,5 +65,5 @@ jobs:
           release-workflow \
           --branch-repo-token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \
           --issue-number ${{ github.event.issue.number }} \
-          --requested-by ${{ github.event.issue.user.login }} \
+          --requested-by ${{ (github.event.action == 'opened' && github.event.issue.body.user.login) || github.event.comment.user.login }} \
           auto

@@ -65,5 +65,5 @@ jobs:
release-workflow \
--branch-repo-token ${{ secrets.RELEASE_WORKFLOW_PUSH_SECRET }} \
--issue-number ${{ github.event.issue.number }} \
--requested-by ${{ github.event.issue.user.login }} \
--requested-by ${{ (github.event.action == 'opened' && github.event.issue.body.user.login) || github.event.comment.user.login }} \
Copy link
Contributor

Choose a reason for hiding this comment

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

Just skimming through the issue webhook event, is this body meant to be bere? It looks to be a string in https://docs.github.com/en/webhooks/webhook-events-and-payloads#issues

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, it's meant to be there. With the GitHub action syntax, the value of an expression is the last expression that is evaluated using short-circuit evaluation rules.. So what this does is that when we have an 'opened' event, the expression will evaluate to github.event.issue.body.user.login otherwise the expression will evaluate to github.event.comment.user.login.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is how you emulate a ternary conditional operator in Github Actions.

Copy link
Contributor

Choose a reason for hiding this comment

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

I meant though that this changes github.event.issue.user.login to github.event.issue.body.user.login

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok, good catch. I had that fix in another commit that I forgot to push. Should be fixed now.

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

Successfully merging this pull request may close these issues.

Github workflow misattributes /cherry-pick backport request comment
3 participants