Skip to content

Commit ffaf2d4

Browse files
committed
Use appropriate commit for push/pr
1 parent ba25e93 commit ffaf2d4

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/main.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,24 @@ jobs:
5050
verbose: true
5151

5252
# Produce an Alire release manifest
53-
- name: Make Release Manifest
53+
- name: Configure Github credentials
5454
run: |
5555
# Set user GitHub login required for `alr publish`
5656
alr config --set --global user.github_login ${{github.repository_owner}}
5757
58-
# Run Alire publish assistant
59-
alr publish ${{github.server_url}}/${{github.repository}} ${{github.sha}}
58+
# Run Alire publish assistant with the appropriate commit
59+
alr publish ${{github.server_url}}/${{github.repository}} ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }}
60+
61+
- if: github.event_name == 'pull_request'
62+
run: alr publish ${{github.server_url}}/${{github.repository}} ${{ github.event.pull_request.head.sha }}
63+
64+
- if: github.event_name == 'push'
65+
run: alr publish ${{github.server_url}}/${{github.repository}} ${{ github.sha }}
6066

6167
# Save the path to the release manifest for the next step.
6268
# This is a little trick to get around the fact that the actions/upload-release-asset doesn't allow globing pattern.
6369
- name: Get Release Manifest PATH
70+
shell: bash
6471
run: |
6572
export MANIFEST_PATHNAME=$(ls alire/releases/*.toml | head -n 1)
6673
echo MANIFEST_PATHNAME=$MANIFEST_PATHNAME >> $GITHUB_ENV

0 commit comments

Comments
 (0)