-
Notifications
You must be signed in to change notification settings - Fork 348
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
T6940: added pr mirror sync caller workflows (revised), and cleaned u…
…p old workflows
- Loading branch information
kumvijaya
committed
Dec 15, 2024
1 parent
eecf5da
commit 77ecda5
Showing
4 changed files
with
73 additions
and
37 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Cleanup pr mirror branch | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- current | ||
workflow_dispatch: | ||
inputs: | ||
branch: | ||
description: 'Branch to delete' | ||
required: true | ||
|
||
permissions: | ||
contents: write | ||
|
||
jobs: | ||
delete_branch: | ||
if: ${{ (github.event_name == 'workflow_dispatch' || startsWith(github.event.pull_request.head.ref, 'mirror/')) && github.repository_owner != 'vyos' }} | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Delete branch | ||
run: | | ||
branch=${{ github.event_name == 'workflow_dispatch' && github.event.inputs.branch || github.event.pull_request.head.ref }} | ||
if [[ $branch != mirror/* ]]; then | ||
echo "Branch name to clean must start with 'mirror/'" | ||
exit 1 | ||
fi | ||
repo=${{ github.repository }} | ||
git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | ||
git push origin --delete $branch |
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Trigger Mirror PR and Repo Sync | ||
on: | ||
pull_request_target: | ||
types: | ||
- closed | ||
branches: | ||
- current | ||
|
||
env: | ||
GH_TOKEN: ${{ secrets.PAT }} | ||
|
||
concurrency: | ||
group: trigger-pr-mirror-repo-sync-${{ github.event.pull_request.base.ref }} | ||
cancel-in-progress: false | ||
jobs: | ||
trigger-mirror-pr-repo-sync: | ||
if: ${{ github.repository_owner == 'vyos' }} | ||
runs-on: ubuntu-latest | ||
permissions: | ||
pull-requests: write | ||
contents: write | ||
|
||
steps: | ||
- name: Bullfrog Secure Runner | ||
uses: bullfrogsec/bullfrog@v0 | ||
with: | ||
egress-policy: audit | ||
|
||
- name: Trigger repo sync | ||
shell: bash | ||
run: | | ||
echo "Triggering sync workflow for ${{ secrets.REMOTE_OWNER }}/${{ secrets.REMOTE_REPO }}" | ||
echo "Triggering sync workflow with PAT ${{ secrets.PAT }}" | ||
curl -X POST \ | ||
-H "Accept: application/vnd.github.everest-preview+json" \ | ||
-H "Authorization: Bearer ${{ secrets.PAT }}" \ | ||
https://api.github.com/repos/${{ secrets.REMOTE_OWNER }}/${{ secrets.REMOTE_REPO }}/actions/workflows/mirror-pr-and-sync.yml/dispatches \ | ||
-d '{"ref":"git-actions", "inputs": {"pr_number": "${{ github.event.pull_request.number }}", "sync_branch": "${{ github.event.pull_request.base.ref }}"}}' |
This file was deleted.
Oops, something went wrong.