Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GitHub Actions Variables List #339

Closed
RaviRamDhali opened this issue Feb 29, 2020 · 3 comments
Closed

GitHub Actions Variables List #339

RaviRamDhali opened this issue Feb 29, 2020 · 3 comments

Comments

@RaviRamDhali
Copy link

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.

@fabasoad
Copy link
Contributor

fabasoad commented 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

@RaviRamDhali
Copy link
Author

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 RaviRamDhali reopened this Mar 14, 2020
@sdras
Copy link
Owner

sdras commented 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 sdras closed this as completed Aug 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants