Skip to content

Initiate Repository #12

Initiate Repository

Initiate Repository #12

Workflow file for this run

name: Initiate Repository
on:
workflow_dispatch:
inputs:
org:
description: The GitHub organization within which the repository is located.
required: true
type: choice
options:
- conda
- conda-incubator
default: conda
repo:
description: The repository to push the update workflow to.
required: true
jobs:
push:
if: >-
!github.event.repository.fork
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
# repository: ${{ github.repository }}
path: upstream
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
with:
repository: ${{ github.event.inputs.org }}/${{ github.event.inputs.repo }}
path: downstream
- name: Configure git user
run: |
git config --global user.name 'Conda Bot'
git config --global user.email '18747875+conda-bot@users.noreply.github.com'
- name: (upstream) Remove repository from sync.yml
# no-op if the repository is not in the sync.yml file
continue-on-error: true
run: sed -i '\%${{ github.event.inputs.org }}/${{ github.event.inputs.repo }}$%d' upstream/sync/config.yml
- name: (upstream) Commit changes
# no-op if there are no updates
continue-on-error: true
run: |
cd upstream
git add .
git commit --message "🤖 updated file(s)"
- name: (upstream) Create fork
# no-op if the repository is already forked
run: |
cd upstream
echo UPSTREAM=$(gh repo fork --clone=false --default-branch-only 2>&1 | awk '{print $1}') >> $GITHUB_ENV
env:
GH_TOKEN: ${{ secrets.SYNC_TOKEN }}
- name: (upstream) Create PR
# no-op if no commits were made
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
with:
path: upstream
push-to-fork: ${{ env.UPSTREAM }}
token: ${{ secrets.SYNC_TOKEN }}
branch: init-${{ github.event.inputs.org }}-${{ github.event.inputs.repo }}
delete-branch: true
title: 🤖 Remove ${{ github.event.inputs.org }}/${{ github.event.inputs.repo }} from `sync.yml`
body: |
[init.yml]: ${{ github.server_url }}/${{ github.repository }}/blob/main/.github/workflows/init.yml
Removes ${{ github.event.inputs.org }}/${{ github.event.inputs.repo }} from the `sync.yml` workflow.
This PR was triggered by @${{ github.triggering_actor }} via ${{ github.event_name }}.
###### Auto-generated by the [`init.yml`][init.yml] workflow, see ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}.
- name: (downstream) Copy (overwrite) update.yml
# no-op if the latest file already exists in the downstream repository
continue-on-error: true
run: |
mkdir -p downstream/.github/workflows/
cp -f upstream/.github/workflows/update.yml downstream/.github/workflows/update.yml
- name: (downstream) Copy (do not overwrite) config.yml
# no-op if the file already exists in the downstream repository
continue-on-error: true
run: |
mkdir -p downstream/.github/template-files/
cp -n upstream/templates/config.yml downstream/.github/template-files/config.yml
- name: (downstream) Commit changes
# no-op if there are no updates
continue-on-error: true
run: |
cd downstream
git add .
git commit --message "🤖 updated file(s)"
- name: (downstream) Create fork
# no-op if the repository is already forked
run: |
cd downstream
echo DOWNSTREAM=$(gh repo fork --clone=false --default-branch-only 2>&1 | awk '{print $1}') >> $GITHUB_ENV
env:
GH_TOKEN: ${{ secrets.SYNC_TOKEN }}
- name: (downstream) Create PR
# no-op if no commits were made
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0
with:
path: downstream
push-to-fork: ${{ env.DOWNSTREAM }}
token: ${{ secrets.SYNC_TOKEN }}
branch: init
delete-branch: true
title: 🤖 Init `update.yml` workflow
body: |
[init.yml]: ${{ github.server_url }}/${{ github.repository }}/blob/main/.github/workflows/init.yml
This adds the `update.yml` workflow (and the accompanying `config.yml`) to this repository to enable regular syncing and templating of standard files (e.g., Code of Conduct file, CLA bot workflow, stale bot workflow, etc.).
This PR was triggered by @${{ github.triggering_actor }} via ${{ github.event_name }}.
###### Auto-generated by the [`init.yml`][init.yml] workflow, see ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}.