Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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?

like image 743
Rogerio Schmitt Avatar asked Jul 18 '20 13:07

Rogerio Schmitt


People also ask

How long can a GitHub action last?

Job execution time - Each job in a workflow can run for up to 6 hours of execution time. If a job reaches this limit, the job is terminated and fails to complete. Workflow run time - Each workflow run is limited to 35 days. If a workflow run reaches this limit, the workflow run is cancelled.


2 Answers

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

on:
  push:
    branches:
      - master
    paths-ignore:
      - '**/README.md'
like image 170
Benjamin W. Avatar answered Oct 12 '22 20:10

Benjamin W.


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.

like image 3
VonC Avatar answered Oct 12 '22 22:10

VonC