Clean code

This commit is contained in:
Laurent Destailleur 2023-06-30 20:04:38 +02:00
parent 61c5400d77
commit 1cd30cd2b3
4 changed files with 0 additions and 108 deletions

View File

@ -1,83 +0,0 @@
# If any file in input folder_path was changed then return true else return false
# echo all changed files
# for PUSH event - compare current commit with previous commit
# for PULL_REQUEST event - compare source branch with target branch
name: If files in folder_path were changed
on:
workflow_call:
outputs:
all_changed_files:
description: List of all changed files in folder_path input
value: ${{ jobs.if-file-changed.outputs.all_changed_files }}
boolean_output:
description: true - if files in folder_path were changed. else false.
value: ${{ jobs.if-file-changed.outputs.boolean_output }}
inputs:
folder_path:
required: true
type: string
jobs:
if-file-changed:
name: Check if files changed
runs-on: ubuntu-latest
outputs:
boolean_output: ${{ steps.get_output.outputs.boolean_output }}
all_changed_files: ${{ steps.get_output.outputs.all_changed_files }}
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
ref: ${{ env.BRANCH }}
fetch-depth: 20 # fetch last 10 commits only
- name: Get files changed on push
# if push on develop or master or main then get diff between current and previous commit
if: github.event_name=='push' && contains(fromJson('["develop", "master", "main"]'), github.ref_name)
id: files_changed_on_push
run: |
all_changed_files=$(git --no-pager diff --name-only HEAD^ HEAD)
echo "::set-output name=all_changed_files::$all_changed_files"
- name: Git files changed when pr is created/updated
# compare source branch with target branch in Pull request
if: github.event_name=='pull_request'
id: files_changed_on_pr
run: |
echo github.head_ref=${{github.head_ref}}
echo github.base_ref=${{github.base_ref}}
git symbolic-ref refs/remotes/origin/HEAD origin/${{github.base_ref}}
all_changed_files=$(git --no-pager diff --name-only origin/${{github.head_ref}} origin/${{github.base_ref}})
echo "::set-output name=all_changed_files::$all_changed_files"
- name: Get combined boolean output
# if request is PUSH or PR , get appropriate boolean_output
id: get_output
run: |
if [[ ${{ steps.files_changed_on_push.outcome }} == "success" ]]; then
all_changed_files=${{ steps.files_changed_on_push.outputs.all_changed_files }}
elif [[ ${{ steps.files_changed_on_pr.outcome }} == "success" ]]; then
all_changed_files=${{ steps.files_changed_on_pr.outputs.all_changed_files }}
fi
echo All files changed are:
echo $all_changed_files
echo Save vars into GITHUB_OUTPUT
echo "all_changed_files=$all_changed_files" >> $GITHUB_OUTPUT
echo "boolean_output=false" >> $GITHUB_OUTPUT
echo "::set-output name=all_changed_files::$all_changed_files"
echo "::set-output name=boolean_output::false"
for file in $all_changed_files; do
echo file = $file
if [[ $file == ${{inputs.folder_path}} ]]; then
echo At least one file was found matching folder_path pattern
echo "::set-output name=boolean_output::true"
echo "boolean_output=false" >> $GITHUB_OUTPUT
break
fi
done

View File

@ -1,25 +0,0 @@
# See syntax file on https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions
name: "Close stale issues (bugs and feature requests)"
on:
schedule:
- cron: "0 20 * * *"
jobs:
stale:
runs-on: ubuntu-latest
steps:
- uses: Dolibarr/stale@master
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
stale-issue-message: 'This issue is stale because it has been open 1 year with no activity. If this is a bug, please comment to confirm it is still present on latest stable version. if this is a feature request, please comment to notify the request is still relevant and not yet covered by latest stable version. This issue may be closed automatically by stale bot in 15 days (you should still be able to re-open it if required).'
stale-issue-label: 'Issue Stale (automatic label)'
exempt-issue-label: 'Priority High / Blocking'
days-before-stale: 365
days-before-close: -1
operations-per-run: 100
#stale-pr-message: 'This PR is stale because it has been open 1 year with no activity. If this PR is still mergeable (no conflict, nor Continuous Integration errors), please comment to confirm this merge is still expected. Without comment, this issue will be closed automatically by stale bot in 15 days.'
stale-pr-label: 'PR Stale (automatic label)'
stale-pr-message:
exempt-pr-label: 'Priority Top Strategic'