To obtain the pathway that caused a pull request in GitHub Workflow, you need to use the context of the pull request event. This context contains information about the pull request, including the branch that the pull request was made against.
Here is an example of how to obtain the branch name of the pull request in a GitHub Workflow:
name: My Workflow
on:
pull_request:
branches:
- main
jobs:
my-job:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.ref }}
- name: Print branch name
run: echo "Branch name is ${{ github.event.pull_request.head.ref }}"
In this example, the pull_request
event is used as a trigger for the workflow. The ref
parameter is used to checkout the branch of the pull request, and the github.event.pull_request.head.ref
context variable is used to obtain the branch name. This branch name can then be used in subsequent steps of the workflow.
Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss
Asked: 2021-10-16 11:00:00 +0000
Seen: 2 times
Last updated: Feb 18 '22
How can I deal with Expression.Error related to a column in Power Query?
How can you implement pagination in Oracle for the LISTAGG() function?
What is the process for implementing a FutureBuilder on an OnTap function in Flutter?
How can we require users to be logged in before they can access the root folders in WordPress?
In SCSS, what is the method for grouping and reusing a set of classes and styles?
How can popen() be used to direct streaming data to TAR?
How does iOS retrieve information from a BLE device?
How can Django Admin accommodate a variety of formats and locales for its input fields?