Repository: hpcaitech/ColossalAI
Pull request: [CI/CD] fix nightly release CD running on forked repo
## 📌 Checklist before creating the PR

- [x] I have created an issue for this PR for traceability
- [x] The title follows the standard format: `[doc/gemini/tensor/...]: A concise description`
- [ ] I have added relevant tags if possible for us to better distinguish different PRs


## 🚨 Issue number

> Link this PR to your issue with words like fixed to automatically close the linked issue upon merge
>
> e.g. `fixed #1234`, `closed #1234`, `resolved #1234`

fixed #2809 

## 📝 What does this PR do?

> Summarize your work here.
> if you have any plots/diagrams/screenshots/tables, please attach them here.

Fixed nightly release CD running on forked repo.
However, I am not sure I am fixing it right... Review NEEDED.


## 💥 Checklist before requesting a review

- [x] I have linked my PR to an issue ([instruction](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue))
- [ ] My issue clearly describes the problem/feature/proposal, with diagrams/charts/table/code if possible
- [x] I have performed a self-review of my code
- [ ] I have added thorough tests.
- [ ] I have added docstrings for all the functions/methods I implemented

## ⭐️ Do you enjoy contributing to Colossal-AI?

- [x] 🌝 Yes, I do.
- [ ] 🌚 No, I don't.

Tell us more if you don't enjoy contributing to Colossal-AI.


Problem statement:
[BUG]: CI/CD - Publish Nightly Version to PyPI runs on forked repo
### 🐛 Describe the bug

Hi, This morning I found that the `Publish Nightly Version to PyPI` CD ran at my forked repo and eventually turned to fail.
I think it was in the `.github/workflows/release_nightly_on_schedule.yml`, we only added conditions to the `build-n-publish` job but not to the `notify` job.
I will try to fix it.

### Environment

_No response_

Hints from issue discussion:

Commit message: [CI/CD] fix nightly release CD running on forker repo

Patch to review:
diff --git a/.github/workflows/release_nightly_on_schedule.yml b/.github/workflows/release_nightly_on_schedule.yml
index aab42e1d754d..e2a8662c6a53 100644
--- a/.github/workflows/release_nightly_on_schedule.yml
+++ b/.github/workflows/release_nightly_on_schedule.yml
@@ -7,7 +7,7 @@ on:
 
 jobs:
   build-n-publish:
-    if: github.event_name == 'workflow_dispatch' || github.repository == 'hpcaitech/ColossalAI'
+    if: github.event_name == 'workflow_dispatch' && github.repository == 'hpcaitech/ColossalAI'
     name: Build and publish Python 🐍 distributions 📦 to PyPI
     runs-on: ubuntu-latest
     timeout-minutes: 20
@@ -31,9 +31,9 @@ jobs:
 
   notify:
     name: Notify Lark via webhook
-    needs: release
+    needs: build-n-publish
     runs-on: ubuntu-latest
-    if: ${{ always() }}
+    if: github.repository == 'hpcaitech/ColossalAI'
     steps:
       - uses: actions/checkout@v2
 


Code review comments:
diff_hunk: @@ -7,7 +7,7 @@ on:
 
 jobs:
   build-n-publish:
-    if: github.event_name == 'workflow_dispatch' || github.repository == 'hpcaitech/ColossalAI'
+    if: github.event_name == 'workflow_dispatch' && github.repository == 'hpcaitech/ColossalAI'
path: .github/workflows/release_nightly_on_schedule.yml
text: @user1:
This is not right. You can just keep this:

```
if: github.repository == 'hpcaitech/ColossalAI'
```

@author:
ok, I found I misunderstand workflow_dispatch.
And DONE

@user1:
I mean, you can remove the `github.event_name == 'workflow_dispatch'`, and leave it like
`if: github.repository == 'hpcaitech/ColossalAI'`