Test workflow #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Sync Fork | |
on: | |
schedule: | |
- cron: '0 10 * * 1' # run every Monday morning | |
workflow_dispatch: # on button click for debugging | |
pull_request: | |
jobs: | |
check-for-open-prs: | |
runs-on: ubuntu-latest | |
outputs: | |
OPEN_FORK_SYNC_PR: ${{ steps.check-for-open-prs.outputs.OPEN_FORK_SYNC_PR }} | |
steps: | |
- name: Check for Open Fork-Sync PRs | |
shell: pwsh | |
run: | | |
$repo = $env:GITHUB_REPOSITORY | |
Write-Host "repo: $repo" | |
$response = (curl https://api.github.com/repos/$repo/pulls?state=open) | Out-String | ConvertFrom-Json | |
$pr_exists = 'false' | |
ForEach ($title in $response.title) { | |
if ($title.contains('Fork Sync')) { | |
$pr_exists = 'true' | |
} | |
} | |
Write-Host "OPEN_FORK_SYNC_PR='$pr_exists'" | |
echo "OPEN_FORK_SYNC_PR='$pr_exists'" >> $GITHUB_OUTPUT | |
test: | |
needs: check-for-open-prs | |
runs-on: ubuntu-latest | |
steps: | |
- run: echo "val of output var - ${{ needs.check-for-open-prs.outputs.OPEN_FORK_SYNC_PR }}" | |
sync: | |
needs: check-for-open-prs | |
if: ${{ needs.check-for-open-prs.outputs.OPEN_FORK_SYNC_PR == 'false' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Run Fork-Sync | |
uses: tgymnich/fork-sync@e2c7edd2fa70502b27eb4ff7644fe8709d1c71cb | |
with: | |
owner: openssh | |
base: latestw_all | |
head: master | |
auto_approve: false | |
ignore_fail: true |