[OTHER] Add Repository Condition to GitHub Actions to Prevent Execution in Forked Repositories
What would you like to share?
Upon syncing the forked repository, I observed that the Storybook and Deploy releases to Vercel GitHub Actions were being triggered and subsequently failing. Here's a screenshot for reference:
I discovered that these two Actions lack a conditional check to ensure they only run in the EddieHubCommunity/LinkFree repository, which leads to these failures in the forked repository.
To remedy this, I suggest we add the following condition to both GitHub Actions. This will prevent them from executing when the repository is a fork, thereby avoiding unnecessary failures:
# .github/workflows/storybook.yml
jobs:
build:
if: github.repository == 'EddieHubCommunity/LinkFree'
runs-on: ubuntu-latest
steps:
# steps here...
deploy:
if: github.repository == 'EddieHubCommunity/LinkFree' && github.event_name != 'pull_request'
# other properties here...
steps:
# steps here...
# .github/workflows/vercel.yml
jobs:
deploy:
if: github.repository == 'EddieHubCommunity/LinkFree'
runs-on: ubuntu-latest
steps:
# steps here...
Upon triaging of this issue, I would be glad to implement these changes. Thanks!
Additional information
No response
To reduce notifications, issues are locked until they are https://github.com/EddieHubCommunity/LinkFree/labels/%F0%9F%8F%81%20status%3A%20ready%20for%20dev and to be assigned. You can learn more in our contributing guide https://github.com/EddieHubCommunity/LinkFree/blob/main/CONTRIBUTING.md
GitHub Actions are disabled by default when forking a repo, but it looks like some people enable them, most Actions should not run as will cause conflicts, especially from the Actions that generate files and new commits - so I think we should disable them all
Thank you for raising the issue, I think it is a good idea, I have assigned it to you
Thank you for raising the issue, I think it is a good idea, I have assigned it to you
Thanks, Eddie. After giving it more thought, I think it might be good for a new community member looking for their first task to tackle this. I'll go ahead and unassign myself for now. 😄
Thank you for raising the issue, I think it is a good idea, I have assigned it to you
Thanks, Eddie. After giving it more thought, I think it might be good for a new community member looking for their first task to tackle this. I'll go ahead and unassign myself for now. 😄
Sure, great idea, thank you 👍
Hello, I checked out the files and the changes needed, and I'd like to try it out as my first task!
awesome @poorvijn I will assign it to you 👍 any questions let us know
hello, I tried implementing the changes needed, and this is what I got:
storybook.yml:
vercel.yml:
I tried to understand how I could fix them, but I couldn't get any further. Could you please suggest something?
- maybe keep the
ifin the same location as before, just append the extra condition to it - don't worry about the
secrets.VERCEL_TOKENerror I get it also, it will run fine on Github Actions
Hey, so I tried changing it as you mentioned, but it's still showing me the same error.
Here's how the storybook.yml file looks with the changes you mentioned:
I also tried copying the code for deployment from the repo and then doing the changes again, but I'm afraid I'm getting the same error
Can you create a draft pull request with your changes and I can see what I get locally - maybe the vscode plugin has a temporary issue (it happens)
done!
Thanks. I will edit your PR description to reference this issue.
Btw I don't get any warnings, the changes look fine to me and are happy in VScode
awesome, I'll check my plugins on VScode. Thank you !