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

Support workflow_run events #259

Open
overbit opened this issue Jan 16, 2023 · 5 comments
Open

Support workflow_run events #259

overbit opened this issue Jan 16, 2023 · 5 comments

Comments

@overbit
Copy link

overbit commented Jan 16, 2023

Behaviour

Expected behaviour

A mention of the default behaviour of type=ref,event=branch is missing and it can lead users to unexpected results.

Actual behaviour

Updating the documentation with the default behaviour for events that are not listed or with an improvement of when a type=ref,event=branch will be used.

Configuration

  • Repository URL (if public): N/A
  • Build URL (if public): N/A
# paste your YAML workflow file here and remove sensitive data
N/A

Logs

Download the log file of your build
and attach it to this issue.

@crazy-max
Copy link
Member

There is no type=branch, did you mean type=ref,event=branch?

@overbit
Copy link
Author

overbit commented Jan 17, 2023

Yes @crazy-max, you are right. I'm updating the issue description.

@overbit
Copy link
Author

overbit commented Jan 17, 2023

My current expectation from the documentation is that type=ref,event=branch will only be enabled for workflows triggered by events related to the branch, such as push, workflow_dispatch, release, and workflow_run.
But for workflow_run I did expect to use the triggering workflow branch instead of github.ref.

What do you thing @crazy-max ?

@crazy-max
Copy link
Member

The action does not support the workflow_run event. I will look at it.

@crazy-max crazy-max changed the title Missing documentation about type=branch on workflow_run events Support workflow_run events Jun 26, 2023
@polarathene
Copy link

But for workflow_run I did expect to use the triggering workflow branch instead of github.ref.

That's how that trigger always worked?

workflow_run event docs:

Note: This event will only trigger a workflow run if the workflow file is on the default branch.

So you should expect to only configure these from that default branch? How are you trying to leverage workflow_run with this action? Pull requests?


Unrelated to this action, I have used workflow_run for PR preview builds of docs where you need to volley an untrusted build over to a trusted context (where you don't want to run third-party code in):

  • Prepare preview workflow (untrusted context, runs in PR branch)
  • Deploy preview workflow (trusted context via workflow_run, runs from default branch)

As you can see in the deploy workflow, there is limited context of the original workflow branch (PR), some of the context needed is volleyed over via export + import of ENV, while other context from workflow_run can be used:

  • github.event.workflow_run.event == 'pull_request'
  • github.event.workflow_run.head_sha
  • github.event.workflow_run.id
  • github.event.workflow_run.conclusion == 'success'

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

No branches or pull requests

3 participants