Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Action ran successfully but didn't enable auto-merge #28

Open
alfieyfc opened this issue Apr 6, 2021 · 6 comments
Open

Action ran successfully but didn't enable auto-merge #28

alfieyfc opened this issue Apr 6, 2021 · 6 comments
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@alfieyfc
Copy link

alfieyfc commented Apr 6, 2021

I'm not sure if I'm correctly expecting what this action does, but imagined as this action is completed, I wouldn't need to click the Enable auto-merge (rebase) button by hand, which isn't happing for me. Did I set it up wrongfully?

image

Here's the action yaml

name: Base Action

# Controls when the action will run.
on:
  # Triggers the workflow on push or pull request events
  pull_request:
    branches: ["*"]
    types: [opened, synchronize]

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
  # Job "enable-auto-merge"
  enable-auto-merge:
    # The type of runner that the job will run on
    runs-on: ubuntu-latest

    # Steps represent a sequence of tasks that will be executed as part of the job
    steps:
      # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
      - uses: alexwilson/[email protected]
        with:
          github-token: "${{ secrets.GITHUB_TOKEN }}"
          merge-method: "REBASE"

Edit:
I enabled ACTION_STEP_DEBUG for the repo and got the below logs
image

@alfieyfc
Copy link
Author

alfieyfc commented Apr 6, 2021

Inspired by peter-evans/enable-pull-request-automerge's input description, I tried using a Personal Access Token and it worked for this action!

(required) A repo scoped Personal Access Token (PAT). Note: GITHUB_TOKEN does not work here.

image
image


I haven't actually thought this entirely through, but my gut feeling tells me PAT doesn't fit my workflow requirement somehow.
Is there something I'm missing to make GITHUB_TOKEN work? Or, is this intended now?

@alfieyfc
Copy link
Author

alfieyfc commented Apr 9, 2021

To put in more context, I tried using Github App token and got the same results of the original issue description.

      - name: Generate token
        id: generate_token
        uses: tibdex/github-app-token@v1
        with:
          app_id: ${{ secrets.APP_ID }}
          private_key: ${{ secrets.APP_PRIVATE_KEY }}
      - name: Enable Pull Request Automerge
        uses: alexwilson/[email protected]
        with:
          github-token: "${{ steps.generate_token.outputs.token }}"
          merge-method: "REBASE"

@alexwilson
Copy link
Owner

Hey, as far as I'm aware app tokens might not have permissions to perform this kind of action as there are restrictions at the app level. You should be able to use the native github_token variable though, does that help achieve the same effect?

@alexwilson
Copy link
Owner

Or rather: I believe you may need to do server-to-server OAuth, to get a token for the context of the installation which your repository sits under. Is that how you're retrieving this token?

@alexwilson alexwilson added bug Something isn't working documentation Improvements or additions to documentation labels Apr 18, 2021
@alexwilson
Copy link
Owner

If you aren't, and depending on how large the work to enable that behaviour is, it might be worth trying to implement this behaviour (I would personally find this behaviour useful!)

@alfieyfc
Copy link
Author

I haven't tried OAuth Apps. What I've tried so far are:

  • native github_token variable, screenshot in original issue body

        - uses: alexwilson/[email protected]
          with:
            github-token: "${{ secrets.GITHUB_TOKEN }}"

    You should be able to use the native github_token variable though

    Sadly this isn't working :( Am I missing some context here?

  • PAT, works as expected, discussed in Action ran successfully but didn't enable auto-merge #28 (comment)

  • Github Apps, followed these steps to set up, doesn't work

    app tokens might not have permissions to perform this kind of action as there are restrictions at the app level

    I'm currently taking this as a fact now, maybe someday Github will make changes on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants