This action allows you to retry shell command for a few times in case they fail. This is especially useful for all kind of network related tasks, such as downloading files or similar. In case the remote endpoint has some issues, the job will not simply fail because of this, but retry the command and eventually reach success.
The following inputs can be used to alter the Docker tag name determination:
Input | Required | Default | Description |
---|---|---|---|
retries |
No | 10 |
How many times to retry on failure. |
pause |
No | 10 |
How many seconds to wait between retries. |
command |
Yes | `` | Shell command to execute. |
workdir |
No | `` | Switch to this working directory prior executing the shell command. |
fail_command |
No | `` | Shell command to execute on every failure of given command . |
None
on: [push]
jobs:
job1:
runs-on: ubuntu-latest
name: Pull docker image
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Build docker image
uses: cytopia/shell-command-retry-action@v0.1.2
with:
retries: 10
pause: 10
command: |
docker build -t test .
# Builing docker sometimes fails on GH Action runner due to network issues.
# We ensure that forwarding is reenabled and the daemon is restarted
# Before retrying the docker build command
fail_command: |
sudo sysctl -w net.ipv4.ip_forward=1 \
&& sudo systemctl restart docker \
Since Dependabot has native GitHub Actions support, to enable it on your GitHub repo all you need to do is add the .github/dependabot.yml
file:
version: 2
updates:
# Maintain dependencies for GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
cytopia GitHub Actions
Name | Description |
---|---|
docker-tag-action | Determines Docker tags based on git branch, commit or git tag |
git-ref-matrix-action | Create stringified JSON list of git refs to be used as a build matrix |
shell-command-retry-action | Retries shell commands to avoid failing pipelines due to network issues |
upload-artifact-verify-action | Upload artifact and verifies it by downloading it again |
upload-artifact-retry-action | Retries upload-artifact-verify-action |
download-artifact-retry-action | Download artifact with retry functionality |
Copyright (c) 2022 cytopia