|
9 | 9 | push: |
10 | 10 | branches: |
11 | 11 | - main |
12 | | - - dev |
13 | 12 |
|
14 | 13 | jobs: |
15 | 14 | Update: |
@@ -38,53 +37,17 @@ jobs: |
38 | 37 | # the minimum number of contributions required to add a user |
39 | 38 | threshold: 1 |
40 | 39 |
|
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)' |
84 | 49 |
|
85 | | - - name: Open Pull Request |
86 | | - |
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