Skip a job if it already succeeded for the same repo state. Uses S3 for caching.

Overview

🪣 ♻️ S3 Cache Action

First Run, Cold Cache Next Run, Cache Hit
On the first run, the action reports no cache and the long task is done. On the next run, the action reports cache hit, and the long task is skipped

Description

Allows to skip a job if it already succeeded for the same repo state. Uses S3 for caching.

This action works for workflow runs across different branches, which is not currently possible using actions/cache.' This allows to e.g. safely skip work after merging to the main branch, if the code was tested/linted/built on a feature branch already.

How It Works

It saves a cache/${repoOwner}/${repoName}/${keyPrefix}/${treeHash} file in an S3 bucket, where treeHash is the current root tree hash of the git repo (i.e. the output of git rev-parse HEAD:). If the GitHub workflow job is ran with the same state of the repository after succeeding once, you can avoid any work by checking the processed output of this action which will be set to true.

Since GitHub Actions do not yet support early exits from jobs, you'll need to check the value of the processed output of this action for every step in the job that you want to avoid.

Note that the action assumes that the AWS credentials have already been configured for the job, and allow to read and write to the S3 bucket provided as input. Use the aws-actions/configure-aws-credentials action in a step prior to running this action to ensure that's the case.

Note that the action requires actions/checkout to be run before it is invoked. This is required in order to determine the repo state.

Inputs

parameter description required default
bucket-name Name of the S3 bucket to use for storing cache files. The job needs to have AWS credentials configured to allow read/write from this bucket. true
key-prefix Key prefix to add to the cache files key. By default the job ID is used. The full key used for the cache files is cache/${repoOwner}/${repoName}/${keyPrefix}/${treeHash} false ${{ github.job }}
aws-region AWS region for the S3 bucket used for cache files. available. true
aws-access-key-id Access Key ID for an IAM user with permissions to read/write to the S3 bucket used for cache files. true
aws-secret-access-key Secret Access Key for an IAM user with permissions to read/write to the S3 bucket used for cache files. true

Outputs

parameter description
processed Indicates if the job has already been performed for the current repo state.
hash The repo tree hash which was used for caching.

Example Use

- uses: aws-actions/configure-aws-credentials@v1
  with:
      # See aws-actions/configure-aws-credentials docs
- uses: pleo-oss/s3-cache-action@v1
  id: s3-cache
  with:
      bucket-name: my-s3-bucket
      aws-region: eu-west-1
      aws-access-key-id: 'aws-access-key-id'
      aws-secret-access-key: 'aws-secret-access-key'
- run: make very-long-lint
  if: steps.s3-cache.outputs.processed == 'false'
- run: make very-long-test
  if: steps.s3-cache.outputs.processed == 'false'

Runs

This action is a node16 action.

Contributing

  • Fork this repository
  • Install dependencies
yarn
  • Make changes
  • Test your changes
make test
  • Lint your changes
make lint
  • Build the action
make build
  • Commit the built Action
  • Submit a PR

PR titles must follow the Conventional Commits spec.

Comments
  • fix: Use /bin/env to search for commands

    fix: Use /bin/env to search for commands

    This will make the execution utility functions more resilient to failures when running on different environments by utilizing /bin/env for finding commands in $PATH.

    opened by andersfischernielsen 4
  • chore(main): release 2.0.1

    chore(main): release 2.0.1

    opened by github-actions[bot] 1
  • chore(main): release 2.0.0

    chore(main): release 2.0.0

    :robot: I have created a release beep boop

    2.0.0 (2022-07-25)

    ⚠ BREAKING CHANGES

    • Makes AWS parameters required since ${{ env }} parameters aren't allowed for default definitions in action.yml.

    Features

    • Fix AWS environment parameters not injecting as expected (#12) (25beab9)

    This PR was generated with Release Please. See documentation.

    autorelease: tagged 
    opened by github-actions[bot] 1
  • chore(main): release 1.1.0

    chore(main): release 1.1.0

    :robot: I have created a release beep boop

    1.1.0 (2022-07-25)

    Features

    • Use AWS input parameters for region and secrets in AWS CLI invocation (#11) (04568e4)
    • Use SWC for fast test execution (#9) (b774f44)

    This PR was generated with Release Please. See documentation.

    autorelease: tagged 
    opened by github-actions[bot] 1
  • chore(main): release 1.0.0

    chore(main): release 1.0.0

    :robot: I have created a release beep boop

    1.0.0 (2022-07-21)

    Miscellaneous Chores


    This PR was generated with Release Please. See documentation.

    autorelease: tagged 
    opened by github-actions[bot] 1
  • chore(main): release 1.0.0

    chore(main): release 1.0.0

    :robot: I have created a release beep boop

    1.0.0 (2022-07-21)

    Miscellaneous Chores


    This PR was generated with Release Please. See documentation.

    autorelease: tagged 
    opened by github-actions[bot] 1
  • chore(main): release 1.0.0

    chore(main): release 1.0.0

    :robot: I have created a release beep boop

    1.0.0 (2022-07-21)

    Miscellaneous Chores


    This PR was generated with Release Please. See documentation.

    autorelease: tagged 
    opened by github-actions[bot] 1
  • Use Auto for releasing

    Use Auto for releasing

    This will use Auto for releasing the repository. This will make releasing the repository less prone to human error by avoiding relying on naming commits and their contents according to the semantic-release format.

    This will change the release workflow to use PR labels for releases, where a PR is labelled as either major, minor, patch or internal (for no release). These labels are verified in PRs and the library will be released, CHANGELOG generated and version bumped similarly to the current release flow.

    minor 
    opened by andersfischernielsen 0
  • feat: Use AWS input parameters for region and secrets in AWS CLI invocation

    feat: Use AWS input parameters for region and secrets in AWS CLI invocation

    This PR will change the Action to take three AWS CLI environment variables:

    • region
    • Access Key ID
    • Secret Access Key

    This is done to avoid errors when running the post-step of the action when the AWS CLI environment variables have been cleared in the configure-aws-credentials post-step. In certain cases the post-step of configure-aws-credentials will remove the environment variables for AWS CLI, leading to s3-cache-action failing because of missing variables.

    BREAKING CHANGE: The Action now takes three optional AWS CLI environment variables for specifying region, Access Key ID and Secret Access Key. The parameters for the Action have also been renamed to follow kebab-case like GitHub's Actions.

    The Action takes AWS CLI parameters in order to avoid errors when running the post-step of the action when the AWS CLI environment variables have been cleared in the configure-aws-credentials post-step. In certain cases the post-step of configure-aws-credentials will remove the environment variables for AWS CLI, leading to s3-cache-action failing because of missing variables.

    opened by andersfischernielsen 0
  • chore: Add contribution instructions

    chore: Add contribution instructions

    This PR adds contribution instructions to the README that are otherwise lacking, making it unnecessarily time consuming to contribute to the code base.

    opened by andersfischernielsen 0
  • chore(main): release 1.0.0

    chore(main): release 1.0.0

    :robot: I have created a release beep boop

    1.0.0 (2022-07-21)

    Miscellaneous Chores


    This PR was generated with Release Please. See documentation.

    autorelease: pending 
    opened by github-actions[bot] 0
  • Configure Renovate

    Configure Renovate

    Mend Renovate

    Welcome to Renovate! This is an onboarding PR to help you understand and configure settings before regular Pull Requests begin.

    🚦 To activate Renovate, merge this Pull Request. To disable Renovate, simply close this Pull Request unmerged.


    Detected Package Files

    • .github/workflows/ci.yml (github-actions)
    • .github/workflows/release.yml (github-actions)
    • package.json (npm)

    Configuration Summary

    Based on the default config's presets, Renovate will:

    • Start dependency updates only once this onboarding PR is merged
    • Enable Renovate Dependency Dashboard creation.
    • If Renovate detects semantic commits, it will use semantic commit type fix for dependencies and chore for all others.
    • Ignore node_modules, bower_components, vendor and various test/tests directories.
    • Autodetect whether to pin dependencies or maintain ranges.
    • Rate limit PR creation to a maximum of two per hour.
    • Limit to maximum 10 open PRs at any time.
    • Group known monorepo packages together.
    • Use curated list of recommended non-monorepo package groupings.
    • A collection of workarounds for known problems with packages.

    🔡 Would you like to change the way Renovate is upgrading your dependencies? Simply edit the renovate.json in this branch with your custom config and the list of Pull Requests in the "What to Expect" section below will be updated the next time Renovate runs.


    What to Expect

    With your current configuration, Renovate will create 11 Pull Requests:

    chore(deps): pin dependencies
    chore(deps): update dependency @​swc/jest to v0.2.23
    • Schedule: ["at any time"]
    • Branch name: renovate/swc-jest-0.x
    • Merge into: main
    • Upgrade @swc/jest to 0.2.23
    chore(deps): update dependency @​types/jest to v28.1.8
    • Schedule: ["at any time"]
    • Branch name: renovate/jest-monorepo
    • Merge into: main
    • Upgrade @types/jest to 28.1.8
    fix(deps): update dependency @​actions/core to v1.9.1 [security]
    • Branch name: renovate/npm-@actions/core-vulnerability
    • Merge into: main
    • Upgrade @actions/core to 1.9.1
    chore(deps): update amannn/action-semantic-pull-request action to v3.7.0
    chore(deps): update dependency @​swc/core to v1.3.4
    • Schedule: ["at any time"]
    • Branch name: renovate/swc-core-1.x
    • Merge into: main
    • Upgrade @swc/core to 1.3.4
    chore(deps): update dependency typescript to v4.8.4
    • Schedule: ["at any time"]
    • Branch name: renovate/typescript-4.x
    • Merge into: main
    • Upgrade typescript to 4.8.4
    fix(deps): update dependency @​actions/github to v5.1.1
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-github-5.x
    • Merge into: main
    • Upgrade @actions/github to 5.1.1
    chore(deps): update actions/setup-node action to v3
    • Schedule: ["at any time"]
    • Branch name: renovate/actions-setup-node-3.x
    • Merge into: main
    • Upgrade actions/setup-node to v3
    chore(deps): update amannn/action-semantic-pull-request action to v4
    chore(deps): update jest monorepo to v29 (major)
    • Schedule: ["at any time"]
    • Branch name: renovate/major-jest-monorepo
    • Merge into: main
    • Upgrade @types/jest to 29.1.1
    • Upgrade jest to 29.1.2

    🚸 Branch creation will be limited to maximum 2 per hour, so it doesn't swamp any CI resources or spam the project. See docs for prhourlylimit for details.


    ❓ Got questions? Check out Renovate's Docs, particularly the Getting Started section. If you need any further assistance then you can also request help here.


    This PR has been generated by Mend Renovate. View repository job log here.

    opened by renovate[bot] 0
Releases(v2.0.1)
Owner
Pleo Open Source
Pleo Open Source
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Generate deterministic fake values: The same input will always generate the same fake-output.

import { copycat } from '@snaplet/copycat' copycat.email('foo') // => '[email protected]' copycat.email('bar') // => 'Thurman.Schowalter668@

Snaplet 201 Dec 30, 2022
Automatically skip Netflix intros, recaps, and next episode prompts ⚡⌛

netflix-skipper Automatically skip Netflix intros, recaps, and next episode prompts ⚡ ⌛ Don't waste any more time waiting or clicking on intros, recap

Ran Ribenzaft 20 Dec 24, 2022
Skip the ads on Thingiverse, and get straight to the good stuff.

Thingiverse STL Downloader Those ads sure are annoying. Skip 'em, and get straight to the good stuff. This repository is here for the normal purposes

Stephan Casas 17 Mar 13, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Simple starter for SvelteKit with Tailwind CSS already set up and ready to go.

Get Started Simple Sveltekit boilerplate with Tailwind CSS already set up. Just run npm install to download the dependencies. Info I use Tailwind in p

Jordan 16 Dec 23, 2022
To-do-List website is a page that contains information that you already listed of shores and things to do.

Project Name To-do-List Description the project. To-do-List website is a page that contains information that you already listed of shores and things t

Laasri Said 9 Oct 14, 2022
Fun way to share some of your (already) public StackOverflow user data to the internet.

ProfileOverflow A simple app leveraging StackExchange APIs to show some StackOverflow accounts information. Made for fun during a weekend as practice.

Jacky Efendi 5 Sep 14, 2022
Allo Caching for Deno

Simple caching solution in Typescript.

Adam Josefus 5 Feb 14, 2022
🪐 The IPFS gateway for NFT.Storage is not "another gateway", but a caching layer for NFTs that sits on top of existing IPFS public gateways.

nftstorage.link The IPFS gateway for nft.storage is not "another gateway", but a caching layer for NFT’s that sits on top of existing IPFS public gate

NFT.Storage 37 Dec 19, 2022
A fast, safe and easy caching mechanism similar to Redis written in typescript

Viper Viper is a memory based caching mechanism which is aimed towards ease of use and speed. It's in a very early stage right now and not meant to us

Japroz Saini 1 Jan 24, 2022
A caching middeware library for Deno HTTP framework, Oak.

Caching middleware library for Oak Table of Contents Description Getting Started Middleware and caching Authors License Description Zoic is an easy-to

OSLabs Beta 64 Sep 28, 2022
Next-level mongoose caching layer with event based cache clearing

SpeedGoose ## About The Project This project is a next-level mongoose caching library which is fully written in typescript. It's caching on two levels

Arkadiusz Gil 17 Dec 15, 2022
Promisified thunk with caching (pronounced "funky")

phunky phunky (promisified thunk, pronounced funky) is yet another thunk-inspired library, to delay a calculation until its result is needed, but also

Matt 2 Oct 14, 2022
This is email scheduler made using MERN. This repo contains server code, client repo is linked in readme.

Email Scheduler Client This is an email scheduler server (client in different repository). It is made using node.js/express.js. Overview User can sign

Sai Charan 2 Dec 3, 2022
Free to use and not for sale. This repo uses scrape or data.json

Aine-MD This script is free, if caught sold, this script will be deleted immediately. Don't forget to follow my github Script ini gratis, Jika ketahua

Aine 119 Dec 30, 2022
365 Days of study and preparation to get an internship and then a job at Google.

365DaysToGoogle 365 Days of study and preparation to get an internship and then a job at Google. Study Program Introduction Let's make a quick introdu

null 8 Jan 19, 2022
Use this app to track and prioritize the topics you need to study during your job search

Interview Skills Grid Use this app to track and prioritize the topics you need to study during your job search. Try it for yourself! --> Interview Ski

R Boyle Software 6 Apr 13, 2022