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

chore: Renew: add or remove 'stale' label #7957

Merged
merged 1 commit into from
Sep 21, 2023

Conversation

totoprayogo1916
Copy link
Contributor

Description
Returning #7950 unexpectedly $mergeable not only results in MERGEABLE or CONFLICTING but also UNKNOWN

Checklist:

  • Securely signed commits

@ddevsr ddevsr added the github_actions Pull requests that update Github_actions code label Sep 21, 2023
@kenjis kenjis merged commit 5712e6c into codeigniter4:develop Sep 21, 2023
3 checks passed
@kenjis
Copy link
Member

kenjis commented Sep 21, 2023

It seems no problem!

@ddevsr
Copy link
Collaborator

ddevsr commented Sep 21, 2023

I forgot for comment.

We have labelling manual stale, and bot will added label and comment only not have label with conflict branch.

Can refactor with this? We remind PR older stale manually. After this if we cant see trigger bot, we can still added manually first and waiting next trigger?

            # CONFLICTING
            if [ "$mergeable" == "CONFLICTING" ]; then
              # No have 'stale` label
              if [[ ! "$labels" == *"stale"* ]]; then
                    # Add "stale" label
                    gh pr edit $url --add-label "stale"
              fi

              # Add a comment
              gh pr comment $url --body ":wave: Hi, @$author!<br><br>We detected conflicts in your PR against the base branch :speak_no_evil:<br>You may want to sync :arrows_counterclockwise: your branch with upstream!<br><br>Ref: [Syncing Your Branch](https://github.com/codeigniter4/CodeIgniter4/blob/develop/contributing/workflow.md#pushing-your-branch)"
            fi

@totoprayogo1916 totoprayogo1916 deleted the conflicting branch September 21, 2023 03:15
@kenjis
Copy link
Member

kenjis commented Sep 21, 2023

@ddevsr Doesn't that make the comment again and again?

@ddevsr
Copy link
Collaborator

ddevsr commented Sep 21, 2023

gh api \
  -H "Accept: application/vnd.github+json" \
  -H "X-GitHub-Api-Version: 2022-11-28" \
  /repos/OWNER/REPO/pulls/PULL_NUMBER/comments

Can we get contains each per each comment on PR from bot using github cli?

@kenjis kenjis changed the title Renew: add or remove 'stale' label chore: Renew: add or remove 'stale' label Sep 21, 2023
@kenjis
Copy link
Member

kenjis commented Sep 21, 2023

@ddevsr What do you mean?
If this workflow works perfectly, we will not label stale manually. It will be added/removed automatically.

@totoprayogo1916
Copy link
Contributor Author

totoprayogo1916 commented Sep 21, 2023

Can we get contains each per each comment on PR from bot using github cli?

yes, see author.is_bot, try yourself: gh pr view 7933 --json number,author

 { 
  "author": {
    "id": "MDQ6VXNlcjg3OTU1",
    "is_bot": false,
    "login": "kenjis",
    "name": "kenjis"
  },
  "number": 7933
}

or specific target : gh pr view 7939 --json number,author

{ 
  "author": {
    "is_bot": true,
    "login": "app/dependabot"
  },
  "number": 7939
}

@totoprayogo1916
Copy link
Contributor Author

@kenjis
please see: https://github.com/codeigniter4/CodeIgniter4/actions/runs/6256398776/job/16987165864
image

The run results show UNKNOWN
It looks like the workflow trigger needs to be tried and changed to a cronjob, so it's no longer push-based.

But we need to review the push again after this.

@kenjis
Copy link
Member

kenjis commented Sep 22, 2023

@totoprayogo1916 I've found the documentation.

The value of the mergeable attribute can be true, false, or null. If the value is null, then GitHub has started a background job to compute the mergeability. After giving the job time to complete, resubmit the request. When the job finishes, you will see a non-null value for the mergeable attribute in the response. If mergeable is true, then merge_commit_sha will be the SHA of the test merge commit.
https://docs.github.com/en/rest/pulls/pulls?apiVersion=2022-11-28#get-a-pull-request

@totoprayogo1916
Copy link
Contributor Author

Push monitoring on develop branch, unable to show "CONFLICTING" value. Meanwhile, the results of the pull request can show which PR is "CONFLICTING".

So, when neither the develop nor 4.x branches are updated by a merged pull request, it cannot attach the label "stale" to the conflicting PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
github_actions Pull requests that update Github_actions code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants