on: issue_comment: types: - created # This action allows people with write access to the repo to rebase a PRs base branch # by commenting `/rebase ${branch}` on the PR while avoiding CODEOWNER notifications. jobs: rebase: runs-on: ubuntu-latest if: github.repository_owner == 'NixOS' && github.event.issue.pull_request != '' && contains(github.event.comment.body, '/rebase') steps: - uses: peter-evans/create-or-update-comment@v1 with: comment-id: ${{ github.event.comment.id }} reactions: eyes - uses: scherermichael-oss/action-has-permission@1.0.6 id: check-write-access with: required-permission: write env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - name: check permissions run: | echo "Commenter doesn't have write access to the repo" exit 1 if: "! steps.check-write-access.outputs.has-permission" - name: setup run: | curl "https://api.github.com/repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}" 2>/dev/null >pr.json cat <>"$GITHUB_ENV" CAN_MODIFY=$(jq -r '.maintainer_can_modify' pr.json) COMMITS=$(jq -r '.commits' pr.json) CURRENT_BASE=$(jq -r '.base.ref' pr.json) PR_BRANCH=$(jq -r '.head.ref' pr.json) COMMENT_BRANCH=$(echo ${{ github.event.comment.body }} | awk "/^\/rebase / {print \$2}") PULL_REQUEST=${{ github.event.issue.number }} EOF rm pr.json - name: check branch env: PERMANENT_BRANCHES: "haskell-updates|master|nixos|nixpkgs|python-unstable|release|staging" VALID_BRANCHES: "haskell-updates|master|python-unstable|release-20.09|staging|staging-20.09|staging-next" run: | message() { cat <