Skip to content

get changes in lines of code #20

get changes in lines of code

get changes in lines of code #20

Workflow file for this run

name: Get Changed Files
on: [push]
jobs:
get_changed_files:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Get previous commit
id: previous_commit
run: |
PREVIOUS_COMMIT=$(git rev-parse HEAD~1)
echo "::set-output name=previous_commit::$PREVIOUS_COMMIT"
shell: bash
- name: List changed files
id: changes
run: |
PREVIOUS_COMMIT=${{ steps.previous_commit.outputs.previous_commit }}
if [ -z "$PREVIOUS_COMMIT" ]; then
echo "No previous commit found."
else
changed_files=$(git diff --name-only $PREVIOUS_COMMIT HEAD)
echo "::set-output name=files::$changed_files"
fi
shell: bash
- name: Display changed files
run: |
changed_files="${{ steps.changes.outputs.files }}"
if [ -n "$changed_files" ]; then
echo "Changed files:"
echo "$changed_files"
else
echo "No files have changed."
fi
shell: bash