Skip to content

Commit

Permalink
Try refining Run Tests GitHub Action again
Browse files Browse the repository at this point in the history
PR #7 triggered the Run Tests action again, but did so multiple times.

I want all pushes to `main` to trigger builds, as well as updates to
pull requests, but not pushes to other branches. And I want each action
to run only once per PR.

This is an attempt to get the right thing to happen based on advice
from:

- https://stackoverflow.com/a/65096459
- https://github.com/orgs/community/discussions/26276#discussioncomment-3251140
  • Loading branch information
mbland committed Nov 25, 2023
1 parent 5ddd486 commit a44c145
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
name: Run Tests

on: [push, pull_request, workflow_dispatch]
on:
push:
branches: [ "main" ]
paths-ignore: [ ".*", "**/.*", "**.md", "**.txt" ]
pull_request:
branches: [ "main" ]
paths-ignore: [ ".*", "**/.*", "**.md", "**.txt" ]
types: [ opened, synchronize, edited, reopened, closed ]
workflow_dispatch:

jobs:
build-test:
name: "Run Tests"
if: >-
github.event_name == 'push' ||
github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand Down

0 comments on commit a44c145

Please sign in to comment.