Skip to content

Latest commit

 

History

History
36 lines (29 loc) · 1.58 KB

README.md

File metadata and controls

36 lines (29 loc) · 1.58 KB

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