[GH-ISSUE #339] GitHub Actions Variables List #1394

Closed
opened 2026-04-17 01:49:12 -05:00 by GiteaMirror · 3 comments
Owner

Originally created by @RaviRamDhali on GitHub (Feb 29, 2020).
Original GitHub issue: https://github.com/sdras/awesome-actions/issues/339

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). Original GitHub issue: https://github.com/sdras/awesome-actions/issues/339 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

<!-- gh-comment-id:593798711 --> @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'

<!-- gh-comment-id:599120347 --> @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.

<!-- gh-comment-id:682241488 --> @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#1394