Skip to content

Checkout a commit created during the same workflow #25985

Answered by Yanjingzhu
boner-cmd asked this question in Actions
Discussion options

You must be logged in to vote

The commit id could be got using git command:

git rev-parse HEAD

You could set an output variable in job “prepare” with the commit id. Then you could get its value through job needs output.
As what @airtower-luna suggested, In job “trystable” , you could specify the commit id as ref input value in checkout step .
Please see my example :

jobs:
  prepare:
    runs-on: ubuntu-latest
    outputs:
      commitid: ${{ steps.commit.outputs.commitid }}
steps:
- uses: actions/checkout@v2
- name: Create local changes
  run: |
    echo "hello" >> sales663.txt
- name: Commit files
  id: commit
  run: |
    git config --local user.email "action@github.com"
    git config --local user.name "gith…

Replies: 8 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants