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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix potential github action smells #8075

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

ceddy4395
Copy link

What does this PR do?

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

  • Stop running workflows when there is a newer commit in PR
  • Prevent running issue/PR actions on forks line
  • Avoid deploying jobs on forks

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

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work. Screenshots may also be helpful.)

Related PRs and Issues

  • (Related PR or issue)

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs?

@detunjiSamuel
Copy link

This is interesting, but why would you not want to run regular jobs/actions in a fork? @ceddy4395

.github/workflows/release.yml Outdated Show resolved Hide resolved
@@ -8,6 +8,8 @@ on:
jobs:
cleanup:
runs-on: ubuntu-latest
permissions:
actions: write
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What does this do?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sure that the workflow cannot make any other changes than alter anything related to GitHub Actions.
For security purposes, it is generally recommended to only give workflows the minimal possible permissions to a repository.

@ceddy4395
Copy link
Author

This is interesting, but why would you not want to run regular jobs/actions in a fork? @ceddy4395

@detunjiSamuel The idea is not to eliminate all workflows from forks but only the ones which do some sort of releasing. In your case the fork will not have access to the correct secrets when logging into Docker Hub and will thus fail by default. Therefore, it's more ideal to just prevent the whole workflow from running.

- Stop running workflows when there is a newer commit in PR
- Prevent running issue/PR actions on forks line
- Avoid deploying jobs on forks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants