From e113fa66e98d512cd3884a8d492f8af7fe2a1697 Mon Sep 17 00:00:00 2001 From: S34N <12197162+S34NW@users.noreply.github.com> Date: Sat, 16 Mar 2024 22:58:00 +0000 Subject: [PATCH] ci for updating PR (#24649) --- .github/workflows/merge_upstream_master.yml | 39 +++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/merge_upstream_master.yml diff --git a/.github/workflows/merge_upstream_master.yml b/.github/workflows/merge_upstream_master.yml new file mode 100644 index 00000000000..1bcb4463238 --- /dev/null +++ b/.github/workflows/merge_upstream_master.yml @@ -0,0 +1,39 @@ +name: Merge Upstream Master +on: + issue_comment: + types: [created] + +jobs: + merge-upstream: + if: ${{ github.event.issue.pull_request && github.event.comment.body == '!merge_upstream' }} + runs-on: ubuntu-latest + steps: + - name: PR Data + run: | + curl -H "Authorization: token ${{ github.token }}" ${{ github.event.issue.pull_request.url }} > pr.json + echo "PR_REPO=`jq -r '.head.repo.full_name' < pr.json`" >> $GITHUB_ENV + echo "PR_BRANCH=`jq -r '.head.ref' < pr.json`" >> $GITHUB_ENV + + - uses: actions/checkout@v4 + with: + repository: ${{ env.PR_REPO }} + ref: ${{ env.PR_BRANCH }} + fetch-depth: 0 + + - name: Perform Merge + run: | + bash tools/hooks/install.sh + bash tgui/bin/tgui --install-git-hooks + chmod +x tools/hooks/*.merge tgui/bin/tgui + git config user.name github-actions + git config user.email github-actions@github.com + git remote add upstream "https://github.com/${{ github.repository }}.git" + git fetch upstream master + git merge upstream/master && git push origin + + - name: Notify Failure + if: failure() + run: | + curl -s -H "Authorization: token ${{ github.token }}" \ + -X POST -d '{"body": "Merging upstream failed:\nhttps://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"}' \ + "https://api.github.com/repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/comments"