Skip to content

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

@dlqqq

Description

@dlqqq

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugBugs reported by users

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions