Skip to content

Commit

Permalink
Refactor workflow to check for updated files
Browse files Browse the repository at this point in the history
  • Loading branch information
Aboudjem committed Feb 18, 2024
1 parent 5217da1 commit 38b7df0
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions .github/workflows/automation_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,25 @@ on:
- fix/*

jobs:
check-updates:
check-files:
runs-on: ubuntu-latest
if: contains(github.head_ref, 'fix/') || contains(github.head_ref, 'release/')
steps:
- uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
package:
- 'package.json'
changelog:
- 'CHANGELOG.md'
- name: Fail if package.json or CHANGELOG.md are not updated
if: ${{ !steps.changes.outputs.package && !steps.changes.outputs.changelog }}
run: |
echo "package.json and CHANGELOG.md must be updated in this PR."
- name: Checkout code
uses: actions/checkout@v2

- name: Get all changed files
id: files
uses: jitterbit/get-changed-files@v1
with:
format: "space"

- name: Check for updated files
run: |
CHANGED_FILES="${{ steps.files.outputs.all }}"
if [[ ! "$CHANGED_FILES" =~ "package.json" ]] || [[ ! "$CHANGED_FILES" =~ "CHANGELOG.md" ]]; then
echo "Error: package.json or CHANGELOG.md must be updated."
exit 1
fi
auto-create-pr-to-dev-main:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 38b7df0

Please sign in to comment.