-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add mkdir, correct forking, & fix no-ops (#972)
* Add comments * Add mkdir * continue-on-error * Redirect * Update init.yml * Remove conda-sandbox
- Loading branch information
1 parent
71cbd98
commit 97d5819
Showing
2 changed files
with
43 additions
and
9 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 |
---|---|---|
|
@@ -37,17 +37,28 @@ jobs: | |
git config --global user.email '[email protected]' | ||
- 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 | ||
|
@@ -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 | ||
|
@@ -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 }}. |
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