GitHub Actions Variables List #17

Closed
opened 2025-11-06 17:06:19 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @RaviRamDhali on GitHub (Feb 29, 2020).

Do you have a list of GitHub Action Variables? I am trying to grab the username and do steps bases on the specific user.

Example: GitHub user MickeyMouse > push > Action > if MickeyMouse do something > else > do another thing.

Originally created by @RaviRamDhali on GitHub (Feb 29, 2020). Do you have a list of GitHub Action Variables? I am trying to grab the username and do steps bases on the specific user. Example: GitHub user MickeyMouse > push > Action > if MickeyMouse do something > else > do another thing.
Author
Owner

@fabasoad commented on GitHub (Mar 3, 2020):

You can use github context for such purpose. Example:

jobs:
  build:
    name: Build
    runs-on: ubuntu-18.04
    steps:
      - uses: actions/checkout@v1
      - if: ${{ github.actor == "MickeyMouse" }}
        run: ./runMickeyScripts.sh
      - if: ${{ github.actor != "MickeyMouse" }}
        run: ./runNotMickeyScripts.sh

Resource:
https://help.github.com/en/actions/reference/contexts-and-expression-syntax-for-github-actions

@fabasoad commented on GitHub (Mar 3, 2020): You can use `github` context for such purpose. Example: ```yaml jobs: build: name: Build runs-on: ubuntu-18.04 steps: - uses: actions/checkout@v1 - if: ${{ github.actor == "MickeyMouse" }} run: ./runMickeyScripts.sh - if: ${{ github.actor != "MickeyMouse" }} run: ./runNotMickeyScripts.sh ``` Resource: https://help.github.com/en/actions/reference/contexts-and-expression-syntax-for-github-actions
Author
Owner

@RaviRamDhali commented on GitHub (Mar 14, 2020):

Just a slight change. The IF statement is after the desired 'run' command.

The below code is working as intended.

jobs:
  main:
    name: WhoCommit
    runs-on: ubuntu-latest
  
    steps:
      - run: echo Committed by ${{github.actor}}
        
      - run: echo Is MickeyMouse
        if: github.actor == 'MickeyMouse'
      
      - run: echo Is Not MickeyMouse
        if: github.actor != 'MickeyMouse'

@RaviRamDhali commented on GitHub (Mar 14, 2020): Just a slight change. The IF statement is after the desired 'run' command. The below code is working as intended. ``` jobs: main: name: WhoCommit runs-on: ubuntu-latest steps: - run: echo Committed by ${{github.actor}} - run: echo Is MickeyMouse if: github.actor == 'MickeyMouse' - run: echo Is Not MickeyMouse if: github.actor != 'MickeyMouse' ```
Author
Owner

@sdras commented on GitHub (Aug 27, 2020):

This seems resolved, also this repo isn't really intended to be documentation but rather house documentation links. Thanks @fabasoad for answering and @RaviRamDhali for the clarification.

@sdras commented on GitHub (Aug 27, 2020): This seems resolved, also this repo isn't really intended to be documentation but rather house documentation links. Thanks @fabasoad for answering and @RaviRamDhali for the clarification.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/awesome-actions#17