Skip to content

Commit

Permalink
Adding an action to set workflow as success when no change is made in…
Browse files Browse the repository at this point in the history
… target paths (#2553)

* update

* Update build.yml

* Update build.yml

* test workflow

* add build_check

* update
  • Loading branch information
LittleLittleCloud authored May 1, 2024
1 parent 5fdaf1a commit e3ccf22
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
31 changes: 30 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
test:
- "test/**"
workflows:
- ".github/workflows/build.yml"
- ".github/workflows/**"
setup:
- "setup.py"
- name: autogen has changes
Expand Down Expand Up @@ -109,3 +109,32 @@ jobs:
with:
file: ./coverage.xml
flags: unittests
build-check:
if: always()
runs-on: ubuntu-latest
needs: [build]
steps:
- name: Get Date
shell: bash
run: |
echo "date=$(date +'%m/%d/%Y %H:%M:%S')" >> "$GITHUB_ENV"
- name: Run Type is ${{ github.event_name }}
if: ${{ github.event_name != 'schedule' && github.event_name != 'workflow_dispatch'}}
shell: bash
run: |
echo "run_type=${{ github.event_name }}" >> "$GITHUB_ENV"
- name: Fail workflow if build failed
id: check_build_failed
if: contains(join(needs.*.result, ','), 'failure')
uses: actions/github-script@v6
with:
script: core.setFailed('Build Failed!')

- name: Fail workflow if build cancelled
id: check_build_cancelled
if: contains(join(needs.*.result, ','), 'cancelled')
uses: actions/github-script@v6
with:
script: core.setFailed('Build Cancelled!')
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
defaults:
run:
working-directory: dotnet
if: success() && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dotnet')
if: success() && (github.ref == 'refs/heads/main')
needs: build
steps:
- uses: actions/checkout@v4
Expand Down

0 comments on commit e3ccf22

Please sign in to comment.