Skip to content

Instantly share code, notes, and snippets.

@tamakiii
Created November 1, 2024 08:57
Show Gist options
  • Select an option

  • Save tamakiii/e202a4bf140f819c64625724991754ae to your computer and use it in GitHub Desktop.

Select an option

Save tamakiii/e202a4bf140f819c64625724991754ae to your computer and use it in GitHub Desktop.

Revisions

  1. tamakiii created this gist Nov 1, 2024.
    29 changes: 29 additions & 0 deletions REAME.md
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    ## Set timeouts
    Specify timeouts in GitHub Actions to prevent prolonged tasks
    ```yaml
    timeout-minutes: 5
    ```
    ## Catch Bash Pipe Errors
    Define the default shell as Bash in the workflow settings, enabling pipefail to detect errors during piping.
    ```yaml
    defaults:
    run:
    shell: bash --noprofile --norc -eo pipefail {0}
    ```
    ## Automatic Workflow Cancellation
    Use concurrency to cancel outdated workflows, reducing unnecessary wait times and costs.
    ```yaml
    concurrency:
    group: ${{ github.workflow }}-${{ github.ref }}
    cancel-in-progress: true #
    ```
    ## Job-Level Permissions for GITHUB_TOKEN
    Control access by disabling default permissions at the workflow level and assigning only necessary permissions per job to minimize security risks.
    ```yaml
    permissions:
    contents: read
    ```