I have a workflow which runs a test
job under given circumstances automatically, or I can run it manually:
name: Test
on:
workflow_dispatch:
inputs:
used-branch:
description: Branch the test shall be run on
default: master
required: true
push:
branches: ['main', 'master']
tags: ['!**']
pull_request:
types: [opened, reopened, ready_for_review]
jobs:
test:
steps:
- name: Checkout selected branch
uses: actions/checkout@v3
if: inputs.used-branch != ''
with:
ref: ${{ github.event.inputs.used-branch }}
- name: Checkout current branch
uses: actions/checkout@v3
with:
ref: ${{github.ref}}
if: inputs.used-branch == ''
- name: Run test
...
I want the test be required before merging. So I check Require status check to pass before merging
, Require branches to be up to date before merging
and specify test
as required job in the repo's branch settings.
The problem is: when I run the workflow manually (and therefore inject the branch via a variable), it's not related to the branch and its success won't be "discovered" by the PR checks.
Is there another way to link the run to a branch, or another way to propagate the result to the branch's pull request?
pr_comment
don't exist either, sadly) for the time being. :) – Aguiepr_comment
events are handled viaissue_comment
because pull requests are just issues with code... docs.github.com/en/actions/using-workflows/… – Boart