Skip to content

Commit

Permalink
Better fork detection in GitHub Actions (#1648)
Browse files Browse the repository at this point in the history
## Problem

- The weblate GitHub Actions do not run because the Git repository was
moved to a different organization.

## Solution

- Use generic `github.event.repository.fork` which does not use any
hardcoded name.
  • Loading branch information
lslezak authored Sep 30, 2024
2 parents f25c5f9 + efc8e3d commit 6ea0da0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
timeout-minutes: 60
runs-on: ubuntu-latest
# do not run scheduled jobs in forks, in forks only allow manual run ("workflow_dispatch")
if: github.repository_owner == 'openSUSE' || github.event_name == 'workflow_dispatch'
if: (!github.event.repository.fork) || github.event_name == 'workflow_dispatch'

steps:

Expand Down Expand Up @@ -101,7 +101,7 @@ jobs:
# see https://github.com/marketplace/actions/irc-message-action
uses: Gottox/irc-message-action@v2
# never run in forks or when triggered manually
if: failure() && github.repository_owner == 'openSUSE' && github.event_name != 'workflow_dispatch'
if: failure() && !github.event.repository.fork && github.event_name != 'workflow_dispatch'
with:
channel: "#yast"
nickname: github-action
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/weblate-merge-po.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
pull-requests: write

# do not run in forks
if: github.repository == 'openSUSE/agama'
if: !github.event.repository.fork

runs-on: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/weblate-merge-products-po.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
pull-requests: write

# do not run in forks
if: github.repository == 'openSUSE/agama'
if: !github.event.repository.fork

runs-on: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/weblate-merge-service-po.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
pull-requests: write

# do not run in forks
if: github.repository_owner == 'openSUSE'
if: !github.event.repository.fork

runs-on: ubuntu-latest

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/weblate-update-pot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ on:
jobs:
update-pot:
# do not run in forks
if: github.repository == 'openSUSE/agama'
if: !github.event.repository.fork

runs-on: ubuntu-latest

Expand Down

0 comments on commit 6ea0da0

Please sign in to comment.