Skip to content

Deal with special case which need some git information such as branch name, commit id .etc in Github actions workflow

Notifications You must be signed in to change notification settings

tonynguyenit18/github-action-custom-vars

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

github-action-custom-vars

This repo is to deal with special cases that you want to git information in Github Actions which is not provided by Github action workflow. For instance:

  • Get branch name which is just merged to main (or any target branch) when run action on main (or any target branch) - Supported
  • Get commit ids in some cases etc. - Please create issues if you find ourself need a special case, we can work together to figure it out.

1. Most recent merged (source) branch name

Required

  • This action need to run on main or any (or any merging target branch)
  • The source branch need to be merge from Github Merge button and the auto message must not be change Look like this
  • If the branch is not merged by Github Merge button, you need to specify branch name e.g xxx xxx/branch-name xxx in commit message

Usage

The branch name will be expose by RECENT_MERGED_BRANCH_NAME variable

Example

name: "Log RECENT_MERGED_BRANCH_NAME"
on:
    push:
      branches:
        - "main"
jobs:
  test:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: tonynguyenit18/github-action-custom-vars@v1
      - run: echo $RECENT_MERGED_BRANCH_NAME

Result

About

Deal with special case which need some git information such as branch name, commit id .etc in Github actions workflow

Resources

Stars

Watchers

Forks

Packages

No packages published