Skip to content

Commit

Permalink
Merge branch 'main' into feature
Browse files Browse the repository at this point in the history
  • Loading branch information
michellewang committed Aug 23, 2023
2 parents e6056db + 54657ec commit 890e22e
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/check_changed_files.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
PATH_CURRENT_REPO: repo_to_check
PATH_TEMPLATE_REPO: template_repo

if: github.repository_owner == 'neurodatascience' && github.event.repository.name != 'testpoppy'
if: github.repository_owner == 'neurodatascience' && github.event.repository.name != 'testpoppy' && github.head_ref != 'main-upstream'

steps:

Expand All @@ -40,7 +40,7 @@ jobs:
COUNT="0"
for FILE in ${CHANGED_FILES}; do
if [ -f "${PATH_TEMPLATE_REPO}/${FILE}" ]; then
echo "::error::File exists in the template repository: ${FILE}"
echo "::error file=${FILE}::File exists in the template repository: ${FILE}"
COUNT=$((COUNT+1))
fi
done
Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/update_dataset_repos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: Update dataset repos

on:
push:
branches:
- 'main'

jobs:

update-dataset-repo:

if: github.repository == 'neurodatascience/testpoppy'

runs-on: ubuntu-latest

env:
TEMPLATE_REPO: neurodatascience/testpoppy

strategy:
fail-fast: false
matrix:
fork:
- neurodatascience/testpoppy-ppmi

steps:

- uses: actions/checkout@v3
with:
repository: ${{ matrix.fork }}

- name: Get upstream changes
run: |
git remote add upstream https://github.com/${TEMPLATE_REPO}.git
git fetch upstream main
git reset --hard upstream/main
- name: Create Pull Request
id: create-pull-request
uses: peter-evans/create-pull-request@v4
with:
title: Update to match ${{ env.TEMPLATE_REPO }}:main
body: PR created/updated automatically by [create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action. Will be merged automatically by [automerge-action](https://github.com/pascalgn/automerge-action) if there are no merge conflicts.
token: ${{ secrets.PAT }}
branch: main-upstream
labels: automerge

# - name: Approve Pull Request
# if: ${{ steps.create-pull-request.outputs.pull-request-number }}
# uses: michellewang/auto-approve-action@v3
# with:
# repository: ${{ matrix.fork }}
# pull-request-number: ${{ steps.create-pull-request.outputs.pull-request-number }}
# review-message: PR approved by [auto-approve-action](https://github.com/michellewang/auto-approve-action) GitHub action.
# github-token: ${{ secrets.GH_ACTION_PAT }}

- name: Automerge Pull Request
id: automerge-pull-request
if: ${{ steps.create-pull-request.outputs.pull-request-number }}
uses: pascalgn/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.PAT }}
MERGE_LABELS: automerge
MERGE_METHOD: merge
MERGE_COMMIT_MESSAGE: "{pullRequest.title} (#{pullRequest.number})"
MERGE_DELETE_BRANCH: "false"
MERGE_ERROR_FAIL: "true"
PULL_REQUEST: ${{ matrix.fork }}/${{ steps.create-pull-request.outputs.pull-request-number }}

- name: Fail job if Pull Request wasn't ready to be merged
if: steps.automerge-pull-request.outputs.mergeResult == 'not_ready'
uses: actions/github-script@v6
with:
script: |
core.setFailed("Pull request #${{ steps.automerge-pull-request.outputs.pullRequestNumber }} is not ready to be merged. This is probably due to merge conflicts: fix them in ${{ env.TEMPLATE_REPO }} or in each of ${{ env.TEMPLATE_REPO }}-[dataset] before trying again.")
3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# testpoppy

A repo for testing GitHub Actions workflows for the Nipoppy project.

0 comments on commit 890e22e

Please sign in to comment.