All Projects → xt0rted → pull-request-comment-branch

xt0rted / pull-request-comment-branch

Licence: MIT License
A GitHub Action to get the head ref and sha of a pull request comment

Programming Languages

typescript
32286 projects

Projects that are alternatives of or similar to pull-request-comment-branch

recent-activity
Add your recent activity to your profile readme!
Stars: ✭ 87 (+314.29%)
Mutual labels:  workflows, github-actions
changed-files
Github action to retrieve all (added, copied, modified, deleted, renamed, type changed, unmerged, unknown) files and directories.
Stars: ✭ 733 (+3390.48%)
Mutual labels:  workflows, github-actions
action-pr-title
Github action to enforce Pull Request title conventions
Stars: ✭ 83 (+295.24%)
Mutual labels:  pull-requests, github-actions
poc-github-actions
Various proofs of concept examples using Github Actions 🤖
Stars: ✭ 103 (+390.48%)
Mutual labels:  workflows, github-actions
nrwl-nx-action
A GitHub Action to wrap Nrwl Nx commands in your workflows.
Stars: ✭ 163 (+676.19%)
Mutual labels:  workflows, github-actions
action-branch-name
Github action to enforce naming convention on branch names
Stars: ✭ 53 (+152.38%)
Mutual labels:  pull-requests, github-actions
aloba
🤖 [Myrmica Aloba 🐜] Bot: Add labels and milestone on pull requests and issues.
Stars: ✭ 18 (-14.29%)
Mutual labels:  pull-requests, github-actions
ok-to-test
Example workflow configuration showing how to use GitHub Actions secrets in pull requests from forks 🍴🔑
Stars: ✭ 58 (+176.19%)
Mutual labels:  pull-requests, github-actions
verify-changed-files
Github action to verify file changes that occur during the workflow execution.
Stars: ✭ 62 (+195.24%)
Mutual labels:  workflows, github-actions
branch-names
Github action to retrieve branch or tag names with support for all events.
Stars: ✭ 99 (+371.43%)
Mutual labels:  workflows, github-actions
action
📦📊 GitHub Action to reports on the size of your npm package
Stars: ✭ 36 (+71.43%)
Mutual labels:  pull-requests, github-actions
pr-reviews-reminder-action
A GitHub Action to send Slack/Teams notification for Pull Request that are waiting for reviewers.
Stars: ✭ 18 (-14.29%)
Mutual labels:  pull-requests, github-actions
memer-action
A GitHub Action for Programmer Memes xD
Stars: ✭ 21 (+0%)
Mutual labels:  pull-requests, workflows
action-github-workflow-sync
Github Action To Sync Github Action's Workflow Files Across Repositories
Stars: ✭ 51 (+142.86%)
Mutual labels:  workflows, github-actions
autoupdate
A GitHub Action that auto-updates pull requests branches, whenever changes are pushed to their destination branch.
Stars: ✭ 70 (+233.33%)
Mutual labels:  pull-requests, github-actions
assign-author
GitHub Actions to assign author to issue or PR
Stars: ✭ 55 (+161.9%)
Mutual labels:  pull-requests, github-actions
ssh2actions
Connect to GitHub Actions VM via SSH for interactive debugging
Stars: ✭ 62 (+195.24%)
Mutual labels:  workflows, github-actions
auto-request-review
A GitHub Action that automatically requests review of a pull request based on files changes and/or groups the author belongs to 🤖
Stars: ✭ 52 (+147.62%)
Mutual labels:  pull-requests, github-actions
metadatamanagement
Metadatamanagement (MDM) - Data Search for Higher Education Research and Science Studies
Stars: ✭ 21 (+0%)
Mutual labels:  github-actions
SpaceSeek
See and search upcoming and previous rocket space launches! Built with React Native, using Detox E2E tests, Fastlane and Github Actions for app store deployment.
Stars: ✭ 19 (-9.52%)
Mutual labels:  github-actions

Pull Request Comment Branch

CI CodeQL

Get the head ref and sha of a pull request comment.

Workflows for pull request comments are triggered using the issue_comment event which runs for both issues and pull requests. This action lets you filter your workflow to comments only on pull requests. It also gets the head ref and sha for the pull request branch which can be used later in the workflow.

The pull request head ref and sha are important because issue_comment workflows run against the repository's default branch (usually mater) and not the pull request's branch. With this action you'll be able to pass the ref to actions/checkout and work with the pull request's code.

Usage

on:
  issue_comment:
    types: [created]

jobs:
  pr-comment:
    runs-on: ubuntu-latest
    steps:
      - uses: xt0rted/pull-request-comment-branch@v1
        id: comment-branch

      - uses: actions/checkout@v2
        if: success()
        with:
          ref: ${{ steps.comment-branch.outputs.head_ref }}

      - run: git rev-parse --abbrev-ref HEAD
      - run: git rev-parse --verify HEAD

Token Permissions

If your repository is using token permissions you'll need to set contents: read and pull-request: read on either the workflow or the job.

Workflow Config

on: issue_comment
permissions:
  contents: read
  pull-requests: read
jobs:
  pr-comment:
    runs-on: ubuntu-latest
    steps:
      - uses: xt0rted/pull-request-comment-branch@v1

Job Config

on: issue_comment
jobs:
  pr-comment:
    runs-on: ubuntu-latest
    permissions:
      contents: read
      pull-requests: read
    steps:
      - uses: xt0rted/pull-request-comment-branch@v1

Options

Required

Name Allowed values Description
repo_token GITHUB_TOKEN (default) or PAT GITHUB_TOKEN token or a repo scoped PAT.

Outputs

Name Decription
base_ref The name of the branch the pull request will merge into.
base_sha The head sha of the branch the pull request will merge into.
head_ref The name of the pull request branch the comment belongs to.
head_sha The head sha of the pull request branch the comment belongs to.
ref Deprecated, use head_ref instead.
sha Deprecated, use head_sha instead.

License

The scripts and documentation in this project are released under the MIT License

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].