From 7f4c55f582a9b08dd438f824a707fb11c4798d60 Mon Sep 17 00:00:00 2001 From: Jan Janssen Date: Fri, 24 Nov 2023 13:45:49 +0100 Subject: [PATCH] Create UpdateDependabotPR.yml --- .github/workflows/UpdateDependabotPR.yml | 37 ++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/UpdateDependabotPR.yml diff --git a/.github/workflows/UpdateDependabotPR.yml b/.github/workflows/UpdateDependabotPR.yml new file mode 100644 index 00000000..c2c71134 --- /dev/null +++ b/.github/workflows/UpdateDependabotPR.yml @@ -0,0 +1,37 @@ +name: UpdateDependabotPR + +on: + pull_request_target: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + if: (github.actor == 'dependabot[bot]') + steps: + - uses: actions/checkout@v2 + with: + ref: ${{ github.event.pull_request.head.ref }} # Check out the head of the actual branch, not the PR + fetch-depth: 0 # otherwise, you will fail to push refs to dest repo + token: ${{ secrets.DEPENDABOT_WORKFLOW_TOKEN }} + - name: UpdateEnvironmentFile + env: + PR_TITLE: ${{ github.event.pull_request.title }} + shell: bash -l {0} + run: | + package=$(echo "$PR_TITLE" | awk '{print $2}') + from=$(echo "$PR_TITLE" | awk '{print $4}') + to=$(echo "$PR_TITLE" | awk '{print $6}') + sed -i "/${package}/s/${from}/${to}/g" .ci_support/environment-mpich.yml + sed -i "/${package}/s/${from}/${to}/g" .ci_support/environment-openmpi.yml + sed -i "/${package}/s/${from}/${to}/g" .ci_support/environment-win.yml + - name: UpdateDependabotPR commit + run: | + git config --local user.email "pyiron@mpie.de" + git config --local user.name "pyironrunner" + git commit -m "[dependabot skip] Update environment" -a + - name: UpdateDependabotPR push + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.DEPENDABOT_WORKFLOW_TOKEN }} + branch: ${{ github.event.pull_request.head.ref }}