Skip to content

Commit

Permalink
devops: using env variables instead of set_output to suppress depreca…
Browse files Browse the repository at this point in the history
…tion warning
  • Loading branch information
dg1223 committed Jul 26, 2023
1 parent ef93a77 commit c4f66c1
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/ci-cd-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
- develop

jobs:
# Don't run CI/CD if only README.md is updated
# Don't run CI/CD if only README.md and/or any .yml file is updated
check_readme_yml_changes:
runs-on: ubuntu-latest
outputs:
Expand All @@ -23,19 +23,16 @@ jobs:
run: |
# Get the list of changed files between the base and head branches
CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }})
echo ${CHANGED_FILES}
# Check if 'README.md' or '.yml' files are the only files changed
if [[ ${CHANGED_FILES} =~ ^(README\.md|.*\.yml)$ && ! ${CHANGED_FILES} =~ ^(?!.*(README\.md|.*\.yml)).*$ ]]; then
echo "Only README.md or .yml files have been updated. Skipping the CI/CD workflow."
echo "::set-output name=run_jobs::false"
# GITHUB_OUTPUT is a default GitHub env. variable
echo "run_jobs=false" >> ${GITHUB_OUTPUT}
else
echo "Changes to files other than README.md or *.yml detected. Proceeding with the CI/CD workflow."
echo "::set-output name=run_jobs::true"
echo "run_jobs=true" >> ${GITHUB_OUTPUT}
fi
# continue-on-error: true

test:
needs: check_readme_yml_changes
if: needs.check_readme_yml_changes.outputs.run_rest_jobs == 'true'
Expand Down

0 comments on commit c4f66c1

Please sign in to comment.