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

[Bug report] The CI cannot be triggered automatically when a backport PR is created by github bot #1282

Closed
Tracked by #1335
jerryshao opened this issue Dec 29, 2023 · 4 comments · Fixed by #1337
Closed
Tracked by #1335
Assignees
Labels
good first issue Good for newcomers help wanted Extra attention is needed

Comments

@jerryshao
Copy link
Contributor

Describe what's wrong

When a backport PR is created by github bot, it cannot automatically trigger the CI, we have to manually close and reopen the PR to trigger it, it's not so convenient.

Error message and/or stacktrace

No

How to reproduce

Just create a backport PR can trigger this issue.

Additional context

No response

@jerryshao jerryshao added good first issue Good for newcomers help wanted Extra attention is needed labels Dec 29, 2023
@BWbwchen
Copy link
Contributor

BWbwchen commented Jan 4, 2024

Hi,

After researching the solution to this issue, I found that this issue is caused by the default setting of GitHub, which prevents triggering a workflow from a workflow.

The solution might be to set the token input used in the github-cherry-pick-action in auto-cherry-pick.yml to some Personal Access Token (PAT), instead of the default token, GITHUB_TOKEN.

According to the official GitHub action documentation, triggering a workflow from a workflow that is generated by the repository's GITHUB_TOKEN is prohibited by default.

When you use the repository's GITHUB_TOKEN to perform tasks, events triggered by the GITHUB_TOKEN, with the exception of workflow_dispatch and repository_dispatch, will not create a new workflow run.

To solve this issue, the documentation gives us some methods:

If you do want to trigger a workflow from within a workflow run, you can use a GitHub App installation access token or a personal access token instead of GITHUB_TOKEN to trigger events that require a token.

The auto-cherry-pick workflow uses carloscastrojumo/[email protected] to push a backport PR and the default token that this action used is GITHUB_TOKEN as shown in its documentation. Thus, we can set the token that github-cherry-pick-action use to some Personal Access Token (PAT) to solve this issue.

Tim

@jerryshao
Copy link
Contributor Author

Thanks a lot @BWbwchen for your investigation, greatly appreciated. Let me see how to use PAT to solve this issue.

@BWbwchen
Copy link
Contributor

BWbwchen commented Jan 5, 2024

It seems that we can use the PAT of the organization.

I can help to contribute to the auto-cherry-pick workflow file. Since I don't have permission to set the PAT for the organization, I might need your help to set a PAT for solving this issue.

@jerryshao
Copy link
Contributor Author

Thanks a lot @BWbwchen , let me check how to create the organization PAT. It would be greatly helpful if you can help improve the auto-cherry-pick workflow.

@qqqttt123 qqqttt123 mentioned this issue Jan 5, 2024
12 tasks
jerryshao pushed a commit that referenced this issue Jan 5, 2024
…flow (#1337)

Based on the document of
[`github-cherry-pick-action`](https://github.com/marketplace/actions/github-cherry-pick-action#action-inputs),
add token input to change the default token that the auto-cherry-pick
workflow used.

> [!WARNING]  
> Need to add a PAT to the organization with the name `BOT_TOKEN`.

### What changes were proposed in this pull request?

Automatically trigger CI for auto-cherry-pick workflow with a customized
token, instead of the default `GITHUB_TOKEN`, which is prohibited from
triggering another workflow.

### Why are the changes needed?

Fix: #1282 

### Does this PR introduce _any_ user-facing change?

No user-facing change, but we should add a PAT to the organization with
the name `BOT_TOKEN`.

### How was this patch tested?

N/A

Signed-off-by: Bo-Wei Chen(BWbwchen) <[email protected]>
github-actions bot pushed a commit that referenced this issue Jan 5, 2024
…flow (#1337)

Based on the document of
[`github-cherry-pick-action`](https://github.com/marketplace/actions/github-cherry-pick-action#action-inputs),
add token input to change the default token that the auto-cherry-pick
workflow used.

> [!WARNING]  
> Need to add a PAT to the organization with the name `BOT_TOKEN`.

### What changes were proposed in this pull request?

Automatically trigger CI for auto-cherry-pick workflow with a customized
token, instead of the default `GITHUB_TOKEN`, which is prohibited from
triggering another workflow.

### Why are the changes needed?

Fix: #1282 

### Does this PR introduce _any_ user-facing change?

No user-facing change, but we should add a PAT to the organization with
the name `BOT_TOKEN`.

### How was this patch tested?

N/A

Signed-off-by: Bo-Wei Chen(BWbwchen) <[email protected]>
qqqttt123 pushed a commit that referenced this issue Jan 5, 2024
…flow (#1342)

Based on the document of
[`github-cherry-pick-action`](https://github.com/marketplace/actions/github-cherry-pick-action#action-inputs),
add token input to change the default token that the auto-cherry-pick
workflow used.

> [!WARNING]  
> Need to add a PAT to the organization with the name `BOT_TOKEN`.

### What changes were proposed in this pull request?

Automatically trigger CI for auto-cherry-pick workflow with a customized
token, instead of the default `GITHUB_TOKEN`, which is prohibited from
triggering another workflow.

### Why are the changes needed?

Fix: #1282 

### Does this PR introduce _any_ user-facing change?

No user-facing change, but we should add a PAT to the organization with
the name `BOT_TOKEN`.

### How was this patch tested?

N/A

Signed-off-by: Bo-Wei Chen(BWbwchen) <[email protected]>
Co-authored-by: Bo-Wei Chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants