Initiate Repository #3
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: 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@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
with: | |
# repository: ${{ github.repository }} | |
path: upstream | |
- uses: actions/checkout@44c2b7a8a4ea60a981eaca3cf939b5f4305c123b # v4.1.5 | |
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 '[email protected]' | |
- name: (upstream) Remove repository from sync.yml | |
run: sed -i '\%${{ github.event.inputs.org }}/${{ github.event.inputs.repo }}$%d' upstream/.github/sync/config.yml | |
- name: (upstream) Commit changes | |
run: cd upstream && git add . && git commit --message "🤖 updated file(s)" || true | |
- name: (upstream) Create fork | |
run: cd upstream && echo UPSTREAM=$(gh repo fork --clone=false --default-branch-only | awk '{print $1}') >> $GITHUB_ENV | |
env: | |
GH_TOKEN: ${{ secrets.SYNC_TOKEN }} | |
- name: (upstream) Create PR | |
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5 | |
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: 🤖 Init ${{ github.event.inputs.org }}/${{ github.event.inputs.repo }} | |
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 | |
run: cp -f upstream/.github/workflows/update.yml downstream/.github/workflows/update.yml || true | |
- name: (downstream) Copy (do not overwrite) config.yml | |
run: cp -n upstream/templates/config.yml downstream/.github/template-files/config.yml || true | |
- name: (downstream) Commit changes | |
run: cd downstream && git add . && git commit --message "🤖 updated file(s)" || true | |
- name: (downstream) Create fork | |
run: cd downstream && echo DOWNSTREAM=$(gh repo fork --clone=false --default-branch-only | awk '{print $1}') >> $GITHUB_ENV | |
env: | |
GH_TOKEN: ${{ secrets.SYNC_TOKEN }} | |
- name: (downstream) Create PR | |
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5 | |
with: | |
path: downstream | |
push-to-fork: ${{ env.DOWNSTREAM }} | |
token: ${{ secrets.SYNC_TOKEN }} | |
branch: init | |
delete-branch: true | |
title: 🤖 Init | |
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 [`update.yml`][update.yml] workflow, see ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}. |