diff --git a/.github/workflows/update-contributors.yml b/.github/workflows/update-contributors.yml index 0121d1f..14fab71 100644 --- a/.github/workflows/update-contributors.yml +++ b/.github/workflows/update-contributors.yml @@ -9,7 +9,6 @@ on: push: branches: - main - - dev jobs: Update: @@ -38,53 +37,17 @@ jobs: # the minimum number of contributions required to add a user threshold: 1 - - name: Checkout New Branch - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - BRANCH_AGAINST: "main" - run: | - printf "GitHub Actor: ${GITHUB_ACTOR}\n" - export BRANCH_FROM="contributors/update-$(date '+%Y-%m-%d')" - git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" - - BRANCH_EXISTS=$(git ls-remote --heads origin ${BRANCH_FROM}) - if [[ -z ${BRANCH_EXISTS} ]]; then - printf "Branch does not exist in remote.\n" - else - printf "Branch already exists in remote.\n" - exit 1 - fi - git branch - git checkout -b "${BRANCH_FROM}" || git checkout "${BRANCH_FROM}" - git branch - - git config --global user.name "github-actions" - git config --global user.email "github-actions@users.noreply.github.com" - - git status - - # Make sure to add new files or path/* - git add .tributors - git add README.md - git add .all-contributorsrc - - if git diff-index --quiet HEAD --; then - export OPEN_PULL_REQUEST=0 - printf "No changes\n" - else - export OPEN_PULL_REQUEST=1 - printf "Changes\n" - git commit -a -m "Automated deployment to update contributors $(date '+%Y-%m-%d')" - git push origin "${BRANCH_FROM}" - fi - echo "::set-env name=OPEN_PULL_REQUEST::${OPEN_PULL_REQUEST}" - echo "::set-env name=PULL_REQUEST_FROM_BRANCH::${BRANCH_FROM}" - echo "::set-env name=PULL_REQUEST_TITLE::[tributors] ${BRANCH_FROM}" - echo "::set-env name=PULL_REQUEST_BODY::Updating tributors automated pull request." + - name: Create Pull Request + id: cpr + uses: peter-evans/create-pull-request@v3 + with: + commit-message: BIDS schema update + base: main + delete-branch: true + title: '[BOT] update git submodules' + body: 'done via this [GitHub Action](https://github.com/cpp-lln-lab/CPP_ROI/blob/main/.github/workflows/update-contributors.yml)' - - name: Open Pull Request - uses: vsoch/pull-request-action@1.0.6 - if: ${{ env.OPEN_PULL_REQUEST == '1' }} - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - PULL_REQUEST_BRANCH: "master" + - name: Check outputs + run: | + echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}" + echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"