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 #9478

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

Conversation

ceddy4395
Copy link

Hey! 🙂
I've made the following changes to your workflow:

  • Avoid jobs without timeouts
    • Jobs without a timeout can cause runners to be occupied when some process falls into an infinite loop or has multiple retries to perform a certain task, which will inevitably fail. Furthermore, it is also useful to be notified when a test-suite all of a sudden takes a lot longer than it used to, considering keeping tests fast is a good practice.
  • Use commit hash instead of tags for action versions
    • When using a tag as version, the code related to the tag can be changed after the tag is created, whereas when using the commit hash this cannot. Therefore, for consistency and security a commit hash should be used.
  • Define permissions for workflows with external actions
    • Permissions should be used when running actions written by other developers because there may be security leaks exposed through these actions.

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

Closes: #

  • Docs
  • Tests

Testing Strategy:

- Avoid jobs without timeouts
- Use commit hash instead of tags for action versions
- Define permissions for workflows with external actions
Copy link

changeset-bot bot commented May 22, 2024

⚠️ No Changeset found

Latest commit: 0bafdae

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented May 22, 2024

Hi @ceddy4395,

Welcome, and thank you for contributing to Remix!

Before we consider your pull request, we ask that you sign our Contributor License Agreement (CLA). We require this only once.

You may review the CLA and sign it by adding your name to contributors.yml.

Once the CLA is signed, the CLA Signed label will be added to the pull request.

If you have already signed the CLA and received this response in error, or if you have any questions, please contact us at [email protected].

Thanks!

- The Remix team

Add ceddy4395 as a contributor
@remix-cla-bot
Copy link
Contributor

remix-cla-bot bot commented May 22, 2024

Thank you for signing the Contributor License Agreement. Let's get this merged! 🥳

outputs:
published_packages: ${{ steps.changesets.outputs.publishedPackages }}
published: ${{ steps.changesets.outputs.published }}
steps:
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4
Copy link
Contributor

Choose a reason for hiding this comment

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

This action is maintained by Github, there should not be any security/breaking changes issues. By pinning to a specific commit hash, you're limiting yourself from potential improvements to the current major version.

This is the same for pnpm and changesets, both are maintained by their respective organization.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree, I think we're fine keeping the numerical versions for these jobs

@@ -20,20 +25,21 @@ jobs:
github.repository == 'remix-run/remix' &&
!contains(github.ref, 'nightly')
runs-on: ubuntu-latest
timeout-minutes: 2
Copy link
Contributor

@alcpereira alcpereira May 28, 2024

Choose a reason for hiding this comment

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

For this job, I don't think 2 minutes is enough, but core maintainers can confirm.
Releases are probably closely monitored, so I don't think there is a real use case to this limit.

Copy link
Contributor

Choose a reason for hiding this comment

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

I agree - a quick peek at past runs shows we've had a few jobs in the 3-5 minute range so I wouldn't go lower than 10-15m here if it's just intended to catch true runaway/hung jobs. Anything under that could result in false positives if github's infra is slowed down.

@@ -9,6 +9,11 @@ on:
- "!release-manual"
- "!release-manual-*"

permissions:
contents: write
pull-requests: write
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you have links to what these are doing versus what the default permissions are? Is this more restrictive? Or just more explicit?

@brophdawg11 brophdawg11 added github_actions Pull requests that update GitHub Actions code labels Jun 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed github_actions Pull requests that update GitHub Actions code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants