different listing logic #3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Update Hub DB from GH Registry | |
on: | |
push: | |
branches: | |
- lyndon/registry-automation # TODO: Remove the branch response | |
pull_request: | |
types: [closed] | |
jobs: | |
upload_to_s3: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Check if it's the first commit on branch | |
id: check_first_commit | |
run: | | |
if [ "${{ github.event.before }}" == "0000000000000000000000000000000000000000" ]; then | |
echo "::set-output name=first_commit::true" | |
else | |
echo "::set-output name=first_commit::false" | |
fi | |
- name: List changed files | |
id: list_files | |
run: | | |
if [ "${{ steps.check_first_commit.outputs.first_commit }}" == "true" ]; then | |
git log --pretty=format:'' --name-only --max-parents=0 ${{ github.sha }} > changed_files.txt | |
else | |
git diff --name-only ${{ github.event.before }} ${{ github.sha }} > changed_files.txt | |
fi | |