From 761ff397384eb3f42c24d5a9753f1298ac14f7de Mon Sep 17 00:00:00 2001 From: Maksym H Date: Thu, 29 Aug 2024 19:17:36 +0100 Subject: [PATCH] Update cmd.yml --- .github/workflows/cmd.yml | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cmd.yml b/.github/workflows/cmd.yml index 10c82e0650..a853409db5 100644 --- a/.github/workflows/cmd.yml +++ b/.github/workflows/cmd.yml @@ -21,7 +21,8 @@ jobs: - name: Load fellows id: load-fellows - uses: paritytech/get-fellows-action@v1.2.0 + #uses: paritytech/get-fellows-action@v1.2.0 + run: echo "github-handles=[mordamax]" >> $GITHUB_OUTPUT reject-non-fellows: needs: fellows @@ -137,7 +138,13 @@ jobs: issue_number: context.issue.number, owner: context.repo.owner, repo: context.repo.repo, - body: `
Command help:${{ steps.help.outputs.help }}
` + body: `
Command help: + + \`\`\` + ${{ steps.help.outputs.help }} + \`\`\` + +
` }) - name: Add confused reaction on failure @@ -225,7 +232,7 @@ jobs: - name: Checkout uses: actions/checkout@v4 with: - ref: ${{ github.head_ref }} + ref: ${{ github.event.issue.pull_request.head.ref }} - name: Set rust version via common env file run: cat .github/env >> $GITHUB_ENV @@ -268,11 +275,18 @@ jobs: git config --local user.email "action@github.com" git config --local user.name "GitHub Action" - git pull origin ${{ github.head_ref }} + git pull origin ${{ github.event.issue.pull_request.head.ref }} git add . git restore --staged Cargo.lock # ignore changes in Cargo.lock git commit -m "Update from ${{ github.actor }} running command '${{ steps.get-pr-comment.outputs.group2 }}'" || true - git push origin ${{ github.head_ref }} + # Check if this is a fork + if [ "${{ github.repository.owner.login }}" != "${{ github.event.repository.owner.login }}" ]; then + echo "Running on a fork, pushing to forked repo"; + git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.event.repository.owner.login }}/${{ github.repository }}.git ${{ github.event.issue.pull_request.head.ref }} + else + echo "Running on the main repo, pushing to the original repo"; + git push origin ${{ github.event.issue.pull_request.head.ref }} + fi else echo "Nothing to commit"; fi