Skip to content

Is it possible to only sync on a push to the default branch? #225

Answered by BetaHuhn
boudewijn-zicht asked this question in Ideas
Discussion options

You must be logged in to vote

During the action execution you have access to the default branch under github.event.repository.default_branch. You could add a check so the sync job only gets executed if the ref matches that value:

name: Sync interproject files

on:
  push:
    branches:
      - release/*
  workflow_dispatch:

jobs:
  sync:
    if: github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2
      - uses: BetaHuhn/repo-file-sync-action@v1
        with:
          GH_PAT: ${{ secrets.REPO_SYNC_PERSONAL_ACCESS_TOKEN }}
          ASSIGNEES: boudewijn-zicht

See related StackOverflow thread.

Hope this helps!

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@boudewijn-zicht
Comment options

Answer selected by boudewijn-zicht
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
2 participants