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

Add mkdir, correct forking, & fix no-ops #972

Merged
merged 6 commits into from
Jul 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
42 changes: 35 additions & 7 deletions .github/workflows/init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,28 @@ jobs:
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/.github/sync/config.yml

- name: (upstream) Commit changes
run: cd upstream && git add . && git commit --message "🤖 updated file(s)" || true
# 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
run: cd upstream && echo UPSTREAM=$(gh repo fork --clone=false --default-branch-only | awk '{print $1}') >> $GITHUB_ENV
# 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@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5
with:
path: upstream
Expand All @@ -66,20 +77,37 @@ jobs:
###### 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
# 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
run: cp -n upstream/templates/config.yml downstream/.github/template-files/config.yml || true
# 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
run: cd downstream && git add . && git commit --message "🤖 updated file(s)" || true
# 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
run: cd downstream && echo DOWNSTREAM=$(gh repo fork --clone=false --default-branch-only | awk '{print $1}') >> $GITHUB_ENV
# 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@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5
with:
path: downstream
Expand All @@ -95,4 +123,4 @@ jobs:

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 }}.
###### Auto-generated by the [`init.yml`][init.yml] workflow, see ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}.
10 changes: 8 additions & 2 deletions .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,16 +59,22 @@ jobs:
- uses: conda/actions/template-files@976289d0cfd85139701b26ddd133abdd025a7b5f # v24.5.0

- name: Commit changes
run: git add . && git commit --message "🤖 updated file(s)" || true
# no-op if there are no updates
continue-on-error: true
run: |
git add .
git commit --message "🤖 updated file(s)"

- if: github.event.comment.body != '@conda-bot render'
name: Create fork
run: echo FORK=$(gh repo fork --clone=false --default-branch-only | awk '{print $1}') >> $GITHUB_ENV
# no-op if the repository is already forked
run: echo FORK=$(gh repo fork --clone=false --default-branch-only 2>&1 | awk '{print $1}') >> $GITHUB_ENV
env:
GH_TOKEN: ${{ secrets.SYNC_TOKEN }}

- if: github.event.comment.body != '@conda-bot render'
id: create
# no-op if no commits were made
uses: peter-evans/create-pull-request@6d6857d36972b65feb161a90e484f2984215f83e # v6.0.5
with:
push-to-fork: ${{ env.FORK }}
Expand Down