Rogerio Schmitt
Rogerio Schmitt

Reputation: 1275

Is it possible to not run github action for readme updates?

I have the following action on Github actions that automatically packs and deploy a package to nuget.org every time a PR gets merged into master.

name: Nuget Deploy

on:
  push:
    branches: [ master ]

jobs:
  build:

    runs-on: windows-latest

    steps:
    - uses: actions/checkout@v2
    - name: Setup .NET Core
      uses: actions/setup-dotnet@v1
      with:
        dotnet-version: 3.1.101
    - name: Generate Nuget package
      run: dotnet pack
      working-directory: DateOverride
    - name: Deploy to nuget.org
      run: dotnet nuget push *.nupkg -k ${{ secrets.NUGET_DEPLOY_KEY }} -s https://api.nuget.org/v3/index.json
      working-directory: DateOverride/DateOverride/bin/Debug

But I would like that it was not run if my update is only a README.md update, is it possible to do so?

Upvotes: 53

Views: 13361

Answers (2)

Benjamin W.
Benjamin W.

Reputation: 52506

I'd think the paths-ignore setting should help:

on:
  push:
    branches:
      - master
    paths-ignore:
      - '**/README.md'

Upvotes: 97

VonC
VonC

Reputation: 1328652

You might want to combine your current GitHiub Action with another like MarceloPrado/has-changed-path

This action outputs whether a path or combination of paths has changed in the previous commit.
[This] action is meant to be used inside your job steps, not at the root of your workflow file

Or (opposite filter): dorny/paths-filter

With this Github Action you can execute your workflow steps only if relevant files are modified.

Upvotes: 3

Related Questions