Skip to content

Commit

Permalink
sync use with
Browse files Browse the repository at this point in the history
  • Loading branch information
sever-sever committed May 30, 2024
1 parent 313a3c5 commit a7c3b60
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 6 deletions.
8 changes: 2 additions & 6 deletions .github/workflows/repo-sync.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
name: Repo-sync-reuse

#secrets:
# REMOTE_REPO: ${{ secrets.REMOTE_REPO }}
# REMOTE_OWNER: ${{ secrets.REMOTE_OWNER }}
# PAT: ${{ secrets.PAT }}

on:
#pull_request:
# types:
Expand All @@ -13,9 +8,10 @@ on:
# - current
workflow_dispatch:

#
jobs:
trigger-sync:
uses: vyos/.github/.github/workflows/trigger-repo-sync.yml@feature/T6349-reusable-workflows
uses: sever-sever/vyos-automate/blob/.github/workflows/trigger-repo-sync.yml@main
secrets:
REMOTE_REPO: ${{ secrets.REMOTE_REPO }}
REMOTE_OWNER: ${{ secrets.REMOTE_OWNER }}
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/trigger-repo-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Trigger repo sync

on:
workflow_call:
secrets:
REMOTE_OWNER:
description: 'Remote repo owner'
type: string
required: true
REMOTE_REPO:
description: 'Remote repo name'
type: string
required: true
PAT:
description: 'Personal Access Token'
type: string
required: true

jobs:
trigger-repo-sync:
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
runs-on: ubuntu-latest
steps:

- name: Trigger sync workflow
shell: bash
env:
REMOTE_OWNER: ${{ secrets.REMOTE_OWNER }}
REMOTE_REPO: ${{ secrets.REMOTE_REPO }}
PAT: ${{ secrets.PAT }}
run: |
echo "Triggering sync workflow for ${{ secrets.REMOTE_OWNER }}/${{ secrets.REMOTE_REPO }}"
echo "Triggering sync workflow with PAT ${{ inputs.PAT }}"
curl -X POST \
-H "Accept: application/vnd.github.everest-preview+json" \
-H "Authorization: Bearer ${{ secrets.PAT }}" \
https://api.github.com/repos/${{ inputs.REMOTE_OWNER }}/${{ inputs.REMOTE_REPO }}/actions/workflows/vyos-repo-sync.yml/dispatches \
-d '{"ref":"git-actions"}'

0 comments on commit a7c3b60

Please sign in to comment.