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

Fix potential github action smells #2097

Merged
merged 6 commits into from
May 13, 2024

Conversation

ceddy4395
Copy link
Contributor

Pull Request

Hey! 🙂
I want to contribute the following changes to your workflow:

  • Use 'if' for upload-artifact action
  • Avoid uploading artifacts on forks
  • Prevent running issue/PR actions on forks
  • Avoid deploying jobs on forks

(These changes are part of a research Study at TU Delft looking at GitHub Action Smells. Find out more)

The issue or feature being addressed

Details on the issue fix or feature implementation

Confirm the following

  • I started this PR by branching from the head of the default branch
  • I have targeted the PR to merge into the default branch
  • I have included unit tests for the issue/feature
  • I have successfully run a local build

- Use 'if' for upload-artifact action
- Avoid uploading artifacts on forks
- Prevent running issue/PR actions on forks
- Avoid deploying jobs on forks
@ceddy4395 ceddy4395 changed the title Fix gha smells: Fix potential github action smells May 5, 2024
.github/workflows/after-release.yml Outdated Show resolved Hide resolved
.github/workflows/build.yml Outdated Show resolved Hide resolved
.github/workflows/build.yml Outdated Show resolved Hide resolved
@gintsk
Copy link
Contributor

gintsk commented May 7, 2024

@martincostello is it really neccessary to run code-scan, ossf-scorecard and stale, etc actions in forks?
It seems that after recent changes all github workflows are enabled for running in forks.

@martincostello
Copy link
Member

I didn't specifically disable it because my understanding was that GitHub automatically disables actions for new forks. This was something I used to do in all my own repos, but I've stopped because I thought the default didn't need it anymore. See https://github.com/orgs/community/discussions/26704#discussioncomment-3252979

If that isn't the case we can look to turn it off explicitly, but if we do so I would want to code to do it the way I suggested in my review, not with hard-coding the repository name: #2097 (comment)

.github/workflows/after-release.yml Outdated Show resolved Hide resolved
.github/workflows/build.yml Show resolved Hide resolved
ceddy4395 and others added 3 commits May 13, 2024 11:03
Restore whitespace.
Disable three additional workflows on forks.
@martincostello martincostello added this to the v8.4.1 milestone May 13, 2024
@martincostello martincostello added enhancement CI/build github_actions Pull requests that update GitHub Actions code labels May 13, 2024
@martincostello martincostello enabled auto-merge (squash) May 13, 2024 09:24
@martincostello martincostello merged commit eb5d8f6 into App-vNext:main May 13, 2024
13 checks passed
Copy link
Contributor

Thanks for your contribution @ceddy4395 - the changes from this pull request have been published as part of version 8.4.1 📦, which is now available from NuGet.org 🚀

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

Successfully merging this pull request may close these issues.

3 participants