Skip to content

Commit

Permalink
chore: create conditional workflow for dotnet-workflow-common
Browse files Browse the repository at this point in the history
  • Loading branch information
luca-sartori-zupit committed Sep 26, 2024
1 parent 881a928 commit 5f33dd0
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 6 deletions.
35 changes: 31 additions & 4 deletions .github/workflows/dotnet-workflow-common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,19 @@ on:
RUN_ON:
required: false
type: string
default: 'zupit-agents'
default: "zupit-agents"
RUNNERS_CONTAINER_GROUP:
required: false
type: string
default: 'Container'
default: "Container"
DOTNET_IMAGE_ENV_VARIABLES:
required: false
type: string
default: '{}'
default: "{}"
CSHARPIER_VERSION:
required: false
type: string
default: ''
default: ""
RUN_LINT:
required: false
type: boolean
Expand All @@ -33,10 +33,37 @@ on:
required: false
type: boolean
default: true
CHECK_WORKDIR_CHANGES:
required: true
type: boolean
default: false
CHECK_CUSTOM_DIR:
required: false
type: string
default: ""
CHECK_CHANGES_BY_JOBS:
required: false
type: string
default: "all"

jobs:
workdir-has-changes:
runs-on: ubuntu-latest
outputs:
changes-detected: ${{ steps.filter.outputs.changes-detected }}
steps:
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
changes-detected:
- ${{ inputs.CHECK_CUSTOM_DIR != '' ? inputs.CHECK_CUSTOM_DIR : inputs.WORKING_DIRECTORY }}
dotnet-common:
needs: workdir-has-changes
name: Run .NET build, check formatting and test
if: ${{ !inputs.CHECK_WORKDIR_CHANGES || (needs.workdir-has-changes.outputs.changes-detected == 'true' && (inputs.CHECK_CHANGES_BY_JOBS == 'all' || contains(fromJson(inputs.CHECK_CHANGES_BY_JOBS), github.job))) }}
runs-on:
labels: ${{ inputs.RUN_ON }}
group: ${{ inputs.RUNNERS_CONTAINER_GROUP }}
Expand Down
4 changes: 4 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"singleQuote": false,
"printWidth": 120
}
18 changes: 18 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"semantic-release": "^21.0.3"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"format": "prettier --write .",
"semantic-release": "semantic-release"
},
"repository": {
Expand All @@ -34,5 +34,8 @@
"bugs": {
"url": "https://github.com/zupit-it/pipeline-templates/issues"
},
"homepage": "https://github.com/zupit-it/pipeline-templates#readme"
"homepage": "https://github.com/zupit-it/pipeline-templates#readme",
"dependencies": {
"prettier": "^3.3.3"
}
}

0 comments on commit 5f33dd0

Please sign in to comment.