Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the GitHub Pull Request ID Number

Is there a way to get and set the Github’s pull request number (example PR #323 ) into Github Actions’s Environment Variable (without the hashtag)?

env:
GITHUB_PR_NUMBER: 323
like image 802
James Avatar asked Sep 08 '25 11:09

James


1 Answers

on:
  pull_request

env:
  GITHUB_PR_NUMBER: ${{github.event.pull_request.number}}
jobs:
  prJob:    
    name: Print event
    runs-on: ubuntu-latest
    steps:
      - run: |
          echo "$GITHUB_PR_NUMBER"

For more information, see https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request

like image 69
riQQ Avatar answered Sep 10 '25 05:09

riQQ