Skip to content

Commit

Permalink
修复pull_request时工作流读取commit报错
Browse files Browse the repository at this point in the history
  • Loading branch information
elysias123 authored Dec 2, 2023
1 parent ac4ef63 commit 02b65ee
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ jobs:
echo "### Build Success" >> $GITHUB_STEP_SUMMARY
echo "|Artifact|SHA256|" >> $GITHUB_STEP_SUMMARY
echo "|:--------:|:----------|" >> $GITHUB_STEP_SUMMARY
canary=($(sha256sum '${{ env.APK_FILE_CANARY }}'))
canary=$(sha256sum "${{ env.APK_FILE_CANARY }}")
echo "SHA256=$canary" >> $GITHUB_ENV
echo "|Canary|$canary" >> $GITHUB_STEP_SUMMARY
Expand All @@ -70,10 +70,14 @@ jobs:

- name: commit
run: |
mkdir -p ${{ github.workspace }}/git_clone
git clone ${{ github.server_url }}/${{ github.repository }} ${{ github.workspace }}/git_clone -b ${{ github.ref_name }}
cd ${{ github.workspace }}/git_clone
echo "commit=$(git log ${{ github.event.before }}..${{ github.event.after }} --pretty=format:'%h %s')" >> $GITHUB_ENV
if [ "${{ github.event_name }}" = "pull_request" ]; then
echo "commit=${{ github.event.head_commit.message }}" >> $GITHUB_ENV
else
mkdir -p ${{ github.workspace }}/git_clone
git clone ${{ github.server_url }}/${{ github.repository }} ${{ github.workspace }}/git_clone -b ${{ github.ref_name }}
cd ${{ github.workspace }}/git_clone
echo "commit=$(git log ${{ github.event.before }}..${{ github.event.after }} --pretty=format:'%h %s')" >> $GITHUB_ENV
fi
- name: Post to Canary Channel
if: ${{ github.event_name != 'pull_request' && github.ref == 'refs/heads/main' && github.ref_type != 'tag' && contains(github.event.head_commit.message, '[skip post]') == false && contains(github.event.head_commit.message, 's#') == false }}
Expand Down

0 comments on commit 02b65ee

Please sign in to comment.