Skip to content

Commit

Permalink
Update pr-convention.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
alankritdabral authored Dec 29, 2023
1 parent 48488e8 commit 863ed62
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions .github/workflows/pr-convention.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,28 @@ name: PR Files Changed

on:
pull_request:
types: [opened, synchronize]
types: [opened, synchronize]

jobs:
list-files:
runs-on: ubuntu-latest
steps:
- name: Fetch PR files (API)
run: |
URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${{ github.event.pull_request.number }}/files"
echo 'FILES<<EOF' >> $GITHUB_ENV
curl -s -X GET -G $URL | jq -r '.[] | .filename' >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
runs-on: ubuntu-latest
steps:
- name: Fetch PR files (API)
run: |
URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls/${{ github.event.pull_request.number }}/files"
echo 'FILES<<EOF' >> $GITHUB_ENV
curl -s -X GET -G $URL | jq -r '.[] | .filename' >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Display file changes
run: |
echo "Files changed (API): $FILES"
echo "Added files: ${{ steps.file_changes.outputs.added }}"
echo "Modified files: ${{ steps.file_changes.outputs.modified }}"
echo "Deleted files: ${{ steps.file_changes.outputs.deleted }}"
- name: Fetch PR files (Action)
id: file_changes
uses: trilom/file-changes-action@v1
with:
githubToken: ${{ secrets.GITHUB_TOKEN }}

- name: Display file changes
run: |
echo "Files changed (API): $FILES"
echo "Added files: ${{ steps.file_changes.outputs.added }}"
echo "Modified files: ${{ steps.file_changes.outputs.modified }}"
echo "Deleted files: ${{ steps.file_changes.outputs.deleted }}"

0 comments on commit 863ed62

Please sign in to comment.