action-pull-request icon indicating copy to clipboard operation
action-pull-request copied to clipboard

Bug: Job fails but still creates the PR

Open 7tupel opened this issue 2 years ago • 6 comments

Description

Running the Action at the latest version (0.5.5) runs into an error. While GH shows an error, the PR is correctly created and visible in the PR view on GH. This step is the last in my workflow, so not critical at the moment, but it is not exactly helpful when a workflow run always shows as failed while it actually achieved what it should have.

Details

Error in the log (last two lines in the job's log):

Error updating issue: Unprocessable Entity (HTTP 422)
Invalid value for "name"

Job configuration in the workflow:

- name: Create Release PR
        id: create-pull-request 
        uses: devops-infra/[email protected]
        with:
          github_token: ${{ github.token }}
          target_branch: 'master'
          source_branch: 'release-${{ steps.timestamp.outputs.time }}'
          title: '[RELEASE] Create a new Release'
          body: Auto-generated by the _Create Release PR_ Action
          label: automated pr, release
          assignee: 7tupel

The output referenced in source_branch is correctly set and is correctly used by the action to create the PR.

My repository is public and available here: https://github.com/ClockworksIO/clci

7tupel avatar Jun 15 '23 14:06 7tupel

hello @7tupel I'll have a look into it next week, as I'm AFK now.

ChristophShyper avatar Jun 15 '23 14:06 ChristophShyper

@7tupel I was able to recreate your issue. It's caused by using single quotation marks in target_branch and source_branch. You can use it without them or replace them with double quotation marks. It's tricky with Actions, as they are not 100% compatible with YAML.

ChristophShyper avatar Jun 20 '23 08:06 ChristophShyper

@7tupel I was able to recreate your issue. It's caused by using single quotation marks in target_branch and source_branch. You can use it without them or replace them with double quotation marks. It's tricky with Actions, as they are not 100% compatible with YAML.

Hi Christoph, I had the same issue too, and I used the single quotation on title, body, old_string, and ignore_users. I will try this double quotation, I'll let you know more about this issue later. Thankyou chris

    create-pr:
        needs: publish-npm
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v3
              with:
                  fetch-depth: 0
            - uses: devops-infra/[email protected]
              with:
                  github_token: ${{ secrets.GITHUB_TOKEN }}
                  source_branch: production
                  target_branch: master
                  title: 'ci: automated production sync to master'
                  body: '**Automated pull request**'
                  reviewer: RnDBNCC
                  assignee: RnDBNCC
                  label: automated-pr, automerge
                  template: .github/PULL_REQUEST_TEMPLATE.md
                  old_string: 'Explain the task'
                  get_diff: true
                  ignore_users: 'dependabot'
                  allow_no_diff: false
            - uses: reitermarkus/automerge@v2
              with:
                  token: ${{ secrets.GITHUB_TOKEN }}
                  merge-method: squash
                  do-not-merge-labels: never-merge
                  required-labels: automerge
                  dry-run: true

RifianFernando avatar Jun 27 '23 17:06 RifianFernando

image image I think the label with coma is the problem?

RifianFernando avatar Jun 29 '23 03:06 RifianFernando

Do you have a space after the coma there? It should be just a coma.

ChristophShyper avatar Jun 29 '23 08:06 ChristophShyper

Do you have a space after the coma there? It should be just a coma.

oh, u're right thanks for the correct information chris, appreciate it 👍

RifianFernando avatar Jun 30 '23 12:06 RifianFernando