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

Can't trigger update snapshots workflow for new PRs #1159

Closed
dlqqq opened this issue Dec 18, 2024 · 2 comments · Fixed by #1160
Closed

Can't trigger update snapshots workflow for new PRs #1159

dlqqq opened this issue Dec 18, 2024 · 2 comments · Fixed by #1160
Labels
bug Something isn't working

Comments

@dlqqq
Copy link
Member

dlqqq commented Dec 18, 2024

Description

Even though I am an owner this repo, commenting "please update snapshots" on a PR sometimes does not trigger the update-snapshots.yml workflow. This is because the workflow runs only if the PR author has the right authorization, not the comment author. So if a new contributor opens a PR, I cannot update the snapshots in that same PR unless I bump the contributor's authorization role. See #1155 as an example.

Excerpt from update-snapshots.yml:

name: Update Playwright Snapshots

on:
  issue_comment:
    types: [created, edited]

permissions:
  contents: write
  pull-requests: write

jobs:
  update-snapshots:
    if: >
      (
        github.event.issue.author_association == 'OWNER' ||
        github.event.issue.author_association == 'COLLABORATOR' ||
        github.event.issue.author_association == 'MEMBER'
      ) && github.event.issue.pull_request && contains(github.event.comment.body, 'please update snapshots')

Proposed solution

The update-snapshots.yml should run based on the role of the user who wrote the comment, not the author of the PR.

Open question

@krassowski Do you know where I can find authoritative documentation on the properties of github.event? I spent 20 minutes trying to determine if this could be fixed by changing issue.author_association to comment.author_association in the condition above. However, I couldn't find a comprehensive list of what properties I can/can't access from the github.event API available here.

@dlqqq dlqqq added the bug Something isn't working label Dec 18, 2024
@krassowski
Copy link
Member

You basically need jupyterlab/jupyterlab#16872

@krassowski
Copy link
Member

Also see jupyterlab/jupyterlab#16730 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants