Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Create external-ci-approved.yml #8235

Merged
merged 3 commits into from
Aug 27, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions .github/workflows/external-ci-approved.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# Mirror PRs labeled external-ci-approved. It will sync on every-reapply.
name: Mirror PRs for External CI

on:
pull_request:
types: [labeled]

jobs:
mirror-pr:
runs-on: ubuntu-latest

if: contains(github.event.pull_request.labels.*.name, 'external-ci-approved')

steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}

- name: Set up Git
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"

- name: Create or update the mirrored branch
run: |
HASH=$(git rev-parse HEAD)
git checkout -b mirrored/${{ github.head_ref }} || git checkout mirrored/${{ github.head_ref }}
git reset --hard $HASH
git push origin mirrored/${{ github.head_ref }} --force

- name: Create or update the mirrored pull request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.AZTEC_BOT_GITHUB_TOKEN }}
base: mirrored/${{ github.head_ref }}
head: ${{ github.head_ref }}
title: "Mirror PR: ${{ github.event.pull_request.title }}"
body: "This PR has been created because #${{ github.event.pull_request.number }} has been labeled external-ci-approved. It will sync on every-reapply."
draft: false
branch: mirrored/${{ github.head_ref }}
update_existing_pr: true
Loading