Skip to content

Commit 47e54a8

Browse files
committed
make job for getting metadata
1 parent e5085a7 commit 47e54a8

File tree

1 file changed

+33
-11
lines changed

1 file changed

+33
-11
lines changed

.github/workflows/build.yml

Lines changed: 33 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -38,32 +38,54 @@ env:
3838
BUILD_CACHE_KEY: ${{ github.event.inputs.commit || github.sha }}
3939

4040
jobs:
41-
job_install_deps:
42-
name: Install Dependencies
41+
job_get_metadata:
42+
name: Get Commit metadata
4343
runs-on: ubuntu-latest
44-
timeout-minutes: 15
4544
steps:
46-
- name: Check out current commit (${{ env.HEAD_COMMIT }})
45+
- name: Check out current commit
4746
uses: actions/checkout@v2
4847
with:
4948
ref: ${{ env.HEAD_COMMIT }}
5049
# We need to check out not only the fake merge commit between the PR and the base branch which GH creates, but
5150
# also its parents, so that we can pull the commit message from the head commit of the PR
5251
fetch-depth: 2
53-
# - name: Get PR head SHA
54-
# run: echo "HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
55-
# - name: Setup tmate session
56-
# uses: mxschmitt/action-tmate@v3
5752
- name: Get metadata
5853
id: get_metadata
5954
run: |
6055
COMMIT_SHA=$(git rev-parse --short ${{ github.event.pull_request.head.sha }})
6156
COMMIT_MESSAGE=$(git log -n 1 --pretty=format:%s ${{ github.event.pull_request.head.sha }})
62-
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> $GITHUB_ENV
6357
echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV
58+
echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> $GITHUB_ENV
59+
echo "::set-output name=commit_sha::$COMMIT_SHA"
6460
echo "::set-output name=commit_message::$COMMIT_MESSAGE"
65-
# - name: "BRANCH: ${{ github.ref_name }}"
66-
# run: echo ""
61+
outputs:
62+
commit_sha: ${{ steps.get_metadata.outputs.commit_sha }}
63+
commit_message: ${{ steps.get_metadata.outputs.commit_message }}
64+
65+
job_install_deps:
66+
name: Install Dependencies
67+
needs: job_get_metadata
68+
runs-on: ubuntu-latest
69+
timeout-minutes: 15
70+
steps:
71+
- name: Check out current commit (${{ needs.job_install_deps.outputs.commit_sha }} -${{ needs.job_install_deps.outputs.commit_message }})
72+
uses: actions/checkout@v2
73+
with:
74+
ref: ${{ env.HEAD_COMMIT }}
75+
# # - name: Get PR head SHA
76+
# # run: echo "HEAD_SHA=${{ github.event.pull_request.head.sha }}" >> $GITHUB_ENV
77+
# # - name: Setup tmate session
78+
# # uses: mxschmitt/action-tmate@v3
79+
# - name: Get metadata
80+
# id: get_metadata
81+
# run: |
82+
# COMMIT_SHA=$(git rev-parse --short ${{ github.event.pull_request.head.sha }})
83+
# COMMIT_MESSAGE=$(git log -n 1 --pretty=format:%s ${{ github.event.pull_request.head.sha }})
84+
# echo "COMMIT_MESSAGE=$COMMIT_MESSAGE" >> $GITHUB_ENV
85+
# echo "COMMIT_SHA=$COMMIT_SHA" >> $GITHUB_ENV
86+
# echo "::set-output name=commit_message::$COMMIT_MESSAGE"
87+
# # - name: "BRANCH: ${{ github.ref_name }}"
88+
# # run: echo ""
6789
- name: "CURRENT COMMIT: ${{ env.COMMIT_SHA }} - ${{ env.COMMIT_MESSAGE }}"
6890
run: echo ""
6991
# - name: "SHA: ${{ github.sha }}"

0 commit comments

Comments
 (0)