Skip to content

Commit 92c4ea4

Browse files
committed
try to fix contributorsn autoupdate
1 parent 6b8bac3 commit 92c4ea4

File tree

1 file changed

+13
-50
lines changed

1 file changed

+13
-50
lines changed

.github/workflows/update-contributors.yml

Lines changed: 13 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ on:
99
push:
1010
branches:
1111
- main
12-
- dev
1312

1413
jobs:
1514
Update:
@@ -38,53 +37,17 @@ jobs:
3837
# the minimum number of contributions required to add a user
3938
threshold: 1
4039

41-
- name: Checkout New Branch
42-
env:
43-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44-
BRANCH_AGAINST: "main"
45-
run: |
46-
printf "GitHub Actor: ${GITHUB_ACTOR}\n"
47-
export BRANCH_FROM="contributors/update-$(date '+%Y-%m-%d')"
48-
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git"
49-
50-
BRANCH_EXISTS=$(git ls-remote --heads origin ${BRANCH_FROM})
51-
if [[ -z ${BRANCH_EXISTS} ]]; then
52-
printf "Branch does not exist in remote.\n"
53-
else
54-
printf "Branch already exists in remote.\n"
55-
exit 1
56-
fi
57-
git branch
58-
git checkout -b "${BRANCH_FROM}" || git checkout "${BRANCH_FROM}"
59-
git branch
60-
61-
git config --global user.name "github-actions"
62-
git config --global user.email "[email protected]"
63-
64-
git status
65-
66-
# Make sure to add new files or path/*
67-
git add .tributors
68-
git add README.md
69-
git add .all-contributorsrc
70-
71-
if git diff-index --quiet HEAD --; then
72-
export OPEN_PULL_REQUEST=0
73-
printf "No changes\n"
74-
else
75-
export OPEN_PULL_REQUEST=1
76-
printf "Changes\n"
77-
git commit -a -m "Automated deployment to update contributors $(date '+%Y-%m-%d')"
78-
git push origin "${BRANCH_FROM}"
79-
fi
80-
echo "::set-env name=OPEN_PULL_REQUEST::${OPEN_PULL_REQUEST}"
81-
echo "::set-env name=PULL_REQUEST_FROM_BRANCH::${BRANCH_FROM}"
82-
echo "::set-env name=PULL_REQUEST_TITLE::[tributors] ${BRANCH_FROM}"
83-
echo "::set-env name=PULL_REQUEST_BODY::Updating tributors automated pull request."
40+
- name: Create Pull Request
41+
id: cpr
42+
uses: peter-evans/create-pull-request@v3
43+
with:
44+
commit-message: BIDS schema update
45+
base: main
46+
delete-branch: true
47+
title: '[BOT] update git submodules'
48+
body: 'done via this [GitHub Action](https://github.com/cpp-lln-lab/CPP_ROI/blob/main/.github/workflows/update-contributors.yml)'
8449

85-
- name: Open Pull Request
86-
uses: vsoch/[email protected]
87-
if: ${{ env.OPEN_PULL_REQUEST == '1' }}
88-
env:
89-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90-
PULL_REQUEST_BRANCH: "master"
50+
- name: Check outputs
51+
run: |
52+
echo "Pull Request Number - ${{ steps.cpr.outputs.pull-request-number }}"
53+
echo "Pull Request URL - ${{ steps.cpr.outputs.pull-request-url }}"

0 commit comments

Comments
 (0)