[GH-ISSUE #2033] github.run_attempt is not defined #975

Closed
opened 2026-03-01 21:47:51 +03:00 by kerem · 1 comment
Owner

Originally created by @noirbizarre on GitHub (Oct 5, 2023).
Original GitHub issue: https://github.com/nektos/act/issues/2033

Bug report info

act version:            0.2.52
GOOS:                   linux
GOARCH:                 amd64
NumCPU:                 8
Docker host:            DOCKER_HOST environment variable is not set
Sockets found:
        /var/run/docker.sock
Config files:           
        /home/noirbizarre/.actrc:
                -P ubuntu-latest=catthehacker/ubuntu:full-latest
                -P ubuntu-20.04=catthehacker/ubuntu:act-20.04
                -P ubuntu-18.04=catthehacker/ubuntu:act-18.04
                -P ubuntu-16.04=catthehacker/ubuntu:act-16.04
Build info:
        Go version:            go1.20.8
        Module path:           github.com/nektos/act
        Main version:          (devel)
        Main path:             github.com/nektos/act
        Main checksum:         
        Build settings:
                -buildmode:           exe
                -compiler:            gc
                -ldflags:             -s -w -X main.version=0.2.52 -X main.commit=44ea01c2097eaad1596f4dafd6ec84872bd00402 -X main.date=2023-10-01T02:15:30Z -X main.builtBy=goreleaser
                CGO_ENABLED:          0
                GOARCH:               amd64
                GOOS:                 linux
                GOAMD64:              v1
                vcs:                  git
                vcs.revision:         44ea01c2097eaad1596f4dafd6ec84872bd00402
                vcs.time:             2023-10-01T02:15:05Z
                vcs.modified:         false
Docker Engine:
        Engine version:        24.0.6
        Engine runtime:        runc
        Cgroup version:        2
        Cgroup driver:         systemd
        Storage driver:        btrfs
        Registry URI:          https://index.docker.io/v1/
        OS:                    Arch Linux
        OS type:               linux
        OS version:            
        OS arch:               x86_64
        OS kernel:             6.5.5-zen1-1-zen
        OS CPU:                8
        OS memory:             15707 MB
        Security options:
                name=seccomp,profile=builtin
                name=cgroupns

Command used with act

act -P ubuntu-latest=catthehacker/ubuntu:act-latest -W .github/workflows/act-github-run-attempt.yml -v

Describe issue

The github context run_attempt property is not set while it should be at least 0

No response

Workflow content

name: Test github.run_attempt

on:
  push:
  pull_request:

env: 
  WORKFLOW_VALUES: ${{ github.run_number }}-${{ github.run_attempt }}

jobs:
  test:
    runs-on: ubuntu-latest
    env: 
      JOB_VALUES: ${{ github.run_number }}-${{ github.run_attempt }}
    steps:
      - run: |
          echo $WORKFLOW_VALUES
          echo $JOB_VALUES
          echo $STEP_VALUES
        env: 
          STEP_VALUES: ${{ github.run_number }}-${{ github.run_attempt }}

Relevant log output

DEBU[0000] Loading environment from /workspace/.env 
DEBU[0000] Loading action inputs from /workspace/.input 
DEBU[0000] Loading secrets from /workspace/.secrets 
DEBU[0000] Loading vars from /workspace/.vars 
DEBU[0000] Evaluated matrix inclusions: map[]           
DEBU[0000] Loading workflow '/workspace/.github/workflows/act-gitb-context-in-env.yml' 
DEBU[0000] Reading workflow '/workspace/.github/workflows/act-gitb-context-in-env.yml' 
DEBU[0000] Preparing plan with all jobs                 
DEBU[0000] Using default workflow event: push           
DEBU[0000] Planning jobs for event: push                
DEBU[0000] Conditional GET for notices etag=c2a8a6e2-b4ff-4ed4-b73f-e8416792e69e 
DEBU[0000] gc: 2023-10-05 12:34:36.178296307 +0200 CEST m=+0.005777167  module=artifactcache
DEBU[0000] Plan Stages: [0xc0003a06a8]                  
DEBU[0000] Stages Runs: [test]                          
DEBU[0000] Job.Name: test                               
DEBU[0000] Job.RawNeeds: {0 0    <nil> []    0 0}       
DEBU[0000] Job.RawRunsOn: {8 0 !!str ubuntu-latest  <nil> []    12 14} 
DEBU[0000] Job.Env: {4 0 !!map   <nil> [0xc0003c1ea0 0xc0003c1f40]    14 7} 
DEBU[0000] Job.If: {0 0  success()  <nil> []    0 0}    
DEBU[0000] Job.Steps: echo $WORKFLOW_VALUES
echo $JOB_VALUES
echo $STEP_VALUES 
DEBU[0000] Job.TimeoutMinutes:                          
DEBU[0000] Job.Services: map[]                          
DEBU[0000] Job.Strategy: <nil>                          
DEBU[0000] Job.RawContainer: {0 0    <nil> []    0 0}   
DEBU[0000] Job.Defaults.Run.Shell:                      
DEBU[0000] Job.Defaults.Run.WorkingDirectory:           
DEBU[0000] Job.Outputs: map[]                           
DEBU[0000] Job.Uses:                                    
DEBU[0000] Job.With: map[]                              
DEBU[0000] Job.Result:                                  
DEBU[0000] Empty Strategy, matrixes=[map[]]             
DEBU[0000] Job Matrices: [map[]]                        
DEBU[0000] Runner Matrices: map[]                       
DEBU[0000] Final matrix after applying user inclusions '[map[]]' 
DEBU[0000] Loading revision from git directory          
DEBU[0000] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc 
DEBU[0000] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc' 
DEBU[0000] using github ref: refs/heads/my/branch   
DEBU[0000] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc 
DEBU[0000] Detected CPUs: 8                             
[Test github.run_attempt/test] [DEBUG] evaluating expression 'success()'
[Test github.run_attempt/test] [DEBUG] expression 'success()' evaluated to 'true'
[Test github.run_attempt/test] 🚀  Start image=catthehacker/ubuntu:act-latest
[Test github.run_attempt/test]   🐳  docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=true
[Test github.run_attempt/test] [DEBUG]   🐳  docker pull catthehacker/ubuntu:act-latest
[Test github.run_attempt/test] [DEBUG] pulling image 'docker.io/catthehacker/ubuntu:act-latest' ()
[Test github.run_attempt/test] using DockerAuthConfig authentication for docker pull
DEBU[0000] Saving notices etag=c2a8a6e2-b4ff-4ed4-b73f-e8416792e69e 
DEBU[0000] No new notices                               
[Test github.run_attempt/test] [DEBUG] Pulling from catthehacker/ubuntu :: act-latest
[Test github.run_attempt/test] [DEBUG] Digest: sha256:58fe9a3572dfd9e1ef9294e1fd969620955d20b045be0960d294b963e112f14c :: 
[Test github.run_attempt/test] [DEBUG] Status: Image is up to date for catthehacker/ubuntu:act-latest :: 
[Test github.run_attempt/test]   🐳  docker create image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Test github.run_attempt/test] [DEBUG] Common container.Config ==> &{Hostname: Domainname: User: AttachStdin:false AttachStdout:false AttachStderr:false ExposedPorts:map[] Tty:true OpenStdin:false StdinOnce:false Env:[RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_ARCH=X64 RUNNER_TEMP=/tmp LANG=C.UTF-8] Cmd:[] Healthcheck:<nil> ArgsEscaped:false Image:catthehacker/ubuntu:act-latest Volumes:map[] WorkingDir:/workspace Entrypoint:[] NetworkDisabled:false MacAddress: OnBuild:[] Labels:map[] StopSignal: StopTimeout:<nil> Shell:[]}
[Test github.run_attempt/test] [DEBUG] Common container.HostConfig ==> &{Binds:[/var/run/docker.sock:/var/run/docker.sock] ContainerIDFile: LogConfig:{Type: Config:map[]} NetworkMode:host PortBindings:map[] RestartPolicy:{Name: MaximumRetryCount:0} AutoRemove:false VolumeDriver: VolumesFrom:[] ConsoleSize:[0 0] Annotations:map[] CapAdd:[] CapDrop:[] CgroupnsMode: DNS:[] DNSOptions:[] DNSSearch:[] ExtraHosts:[] GroupAdd:[] IpcMode: Cgroup: Links:[] OomScoreAdj:0 PidMode: Privileged:false PublishAllPorts:false ReadonlyRootfs:false SecurityOpt:[] StorageOpt:map[] Tmpfs:map[] UTSMode: UsernsMode: ShmSize:0 Sysctls:map[] Runtime: Isolation: Resources:{CPUShares:0 Memory:0 NanoCPUs:0 CgroupParent: BlkioWeight:0 BlkioWeightDevice:[] BlkioDeviceReadBps:[] BlkioDeviceWriteBps:[] BlkioDeviceReadIOps:[] BlkioDeviceWriteIOps:[] CPUPeriod:0 CPUQuota:0 CPURealtimePeriod:0 CPURealtimeRuntime:0 CpusetCpus: CpusetMems: Devices:[] DeviceCgroupRules:[] DeviceRequests:[] KernelMemory:0 KernelMemoryTCP:0 MemoryReservation:0 MemorySwap:0 MemorySwappiness:<nil> OomKillDisable:<nil> PidsLimit:<nil> Ulimits:[] CPUCount:0 CPUPercent:0 IOMaximumIOps:0 IOMaximumBandwidth:0} Mounts:[{Type:volume Source:act-Test-github-run-attempt-test-9da691d3342549b99b1d0c82baed9ecf973ad03dc91d9d874f0837c54d9bb81d Target:/workspace ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>} {Type:volume Source:act-toolcache Target:/toolcache ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>} {Type:volume Source:act-Test-github-run-attempt-test-9da691d3342549b99b1d0c82baed9ecf973ad03dc91d9d874f0837c54d9bb81d-env Target:/var/run/act ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>}] MaskedPaths:[] ReadonlyPaths:[] Init:<nil>}
[Test github.run_attempt/test] [DEBUG] Created container name=act-Test-github-run-attempt-test-9da691d3342549b99b1d0c82baed9ecf973ad03dc91d9d874f0837c54d9bb81d id=e63c9cb3aa22e22068d972e0975553d5b3b76124de62689ab9158bf5b5d71eb7 from image catthehacker/ubuntu:act-latest (platform: )
[Test github.run_attempt/test] [DEBUG] ENV ==> [RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_ARCH=X64 RUNNER_TEMP=/tmp LANG=C.UTF-8]
[Test github.run_attempt/test]   🐳  docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[]
[Test github.run_attempt/test] [DEBUG] Starting container: e63c9cb3aa22e22068d972e0975553d5b3b76124de62689ab9158bf5b5d71eb7
[Test github.run_attempt/test] [DEBUG] Started container: e63c9cb3aa22e22068d972e0975553d5b3b76124de62689ab9158bf5b5d71eb7
[Test github.run_attempt/test] [DEBUG] Writing entry to tarball workflow/event.json len:2
[Test github.run_attempt/test] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
[Test github.run_attempt/test] [DEBUG] Extracting content to '/var/run/act/'
[Test github.run_attempt/test] [DEBUG] Loading revision from git directory
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc'
[Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] expression '${{ github.run_number }}-${{ github.run_attempt }}' rewritten to 'format('{0}-{1}', github.run_number, github.run_attempt)'
[Test github.run_attempt/test] [DEBUG] evaluating expression 'format('{0}-{1}', github.run_number, github.run_attempt)'
[Test github.run_attempt/test] [DEBUG] expression 'format('{0}-{1}', github.run_number, github.run_attempt)' evaluated to '%!t(string=1-)'
[Test github.run_attempt/test] [DEBUG] expression '${{ github.run_number }}-${{ github.run_attempt }}' rewritten to 'format('{0}-{1}', github.run_number, github.run_attempt)'
[Test github.run_attempt/test] [DEBUG] evaluating expression 'format('{0}-{1}', github.run_number, github.run_attempt)'
[Test github.run_attempt/test] [DEBUG] expression 'format('{0}-{1}', github.run_number, github.run_attempt)' evaluated to '%!t(string=1-)'
[Test github.run_attempt/test] [DEBUG] Loading revision from git directory
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc'
[Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] Loading revision from git directory
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc'
[Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] expression '${{ github.run_number }}-${{ github.run_attempt }}' rewritten to 'format('{0}-{1}', github.run_number, github.run_attempt)'
[Test github.run_attempt/test] [DEBUG] evaluating expression 'format('{0}-{1}', github.run_number, github.run_attempt)'
[Test github.run_attempt/test] [DEBUG] expression 'format('{0}-{1}', github.run_number, github.run_attempt)' evaluated to '%!t(string=1-)'
[Test github.run_attempt/test] [DEBUG] Loading revision from git directory
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc'
[Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] setupEnv => map[ACT:true ACTIONS_CACHE_URL:http://192.168.10.142:33401/ CI:true GITHUB_ACTION:0 GITHUB_ACTIONS:true GITHUB_ACTION_PATH: GITHUB_ACTION_REF: GITHUB_ACTION_REPOSITORY: GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_BASE_REF: GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:test GITHUB_REF:refs/heads/my/branch GITHUB_REF_NAME:my/branch GITHUB_REF_TYPE:branch GITHUB_REPOSITORY:me/actions GITHUB_REPOSITORY_OWNER:me GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:a9bd00a9c9a9a615b84b016c2faddf962e3411dc GITHUB_TOKEN: GITHUB_WORKFLOW:Test github.run_attempt GITHUB_WORKSPACE:/workspace ImageOS:ubuntu20 JOB_VALUES:1- RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID: STEP_VALUES:1- WORKFLOW_VALUES:1-]
[Test github.run_attempt/test] [DEBUG] Loading revision from git directory
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc'
[Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] Loading revision from git directory
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc'
[Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] evaluating expression ''
[Test github.run_attempt/test] [DEBUG] expression '' evaluated to 'true'
[Test github.run_attempt/test] ⭐ Run Main echo $WORKFLOW_VALUES
echo $JOB_VALUES
echo $STEP_VALUES
[Test github.run_attempt/test] [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0
[Test github.run_attempt/test] [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0
[Test github.run_attempt/test] [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0
[Test github.run_attempt/test] [DEBUG] Writing entry to tarball workflow/envs.txt len:0
[Test github.run_attempt/test] [DEBUG] Writing entry to tarball workflow/SUMMARY.md len:0
[Test github.run_attempt/test] [DEBUG] Extracting content to '/var/run/act'
[Test github.run_attempt/test] [DEBUG] Loading revision from git directory
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc'
[Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] Loading revision from git directory
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc'
[Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] Loading revision from git directory
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc'
[Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] Loading revision from git directory
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc'
[Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] Wrote command 

echo $WORKFLOW_VALUES
echo $JOB_VALUES
echo $STEP_VALUES


 to 'workflow/0'
[Test github.run_attempt/test] [DEBUG] Writing entry to tarball workflow/0 len:59
[Test github.run_attempt/test] [DEBUG] Extracting content to '/var/run/act'
[Test github.run_attempt/test]   🐳  docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0] user= workdir=
[Test github.run_attempt/test] [DEBUG] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0]'
[Test github.run_attempt/test] [DEBUG] Working directory '/workspace'
| 1-
| 1-
| 1-
[Test github.run_attempt/test]   ✅  Success - Main echo $WORKFLOW_VALUES
echo $JOB_VALUES
echo $STEP_VALUES
[Test github.run_attempt/test] [DEBUG] Removed container: e63c9cb3aa22e22068d972e0975553d5b3b76124de62689ab9158bf5b5d71eb7
[Test github.run_attempt/test] [DEBUG]   🐳  docker volume rm act-Test-github-run-attempt-test-9da691d3342549b99b1d0c82baed9ecf973ad03dc91d9d874f0837c54d9bb81d
[Test github.run_attempt/test] [DEBUG]   🐳  docker volume rm act-Test-github-run-attempt-test-9da691d3342549b99b1d0c82baed9ecf973ad03dc91d9d874f0837c54d9bb81d-env
[Test github.run_attempt/test] 🏁  Job succeeded
[Test github.run_attempt/test] [DEBUG] Loading revision from git directory
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc
[Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc'
[Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch
[Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc

Additional information

Having github.run_attempt always set 0 should fix it.
Providing a way to set it from the command line (eg. like --attempt=3) could be a good bonus allowing to test workflow retry

Originally created by @noirbizarre on GitHub (Oct 5, 2023). Original GitHub issue: https://github.com/nektos/act/issues/2033 ### Bug report info ```plain text act version: 0.2.52 GOOS: linux GOARCH: amd64 NumCPU: 8 Docker host: DOCKER_HOST environment variable is not set Sockets found: /var/run/docker.sock Config files: /home/noirbizarre/.actrc: -P ubuntu-latest=catthehacker/ubuntu:full-latest -P ubuntu-20.04=catthehacker/ubuntu:act-20.04 -P ubuntu-18.04=catthehacker/ubuntu:act-18.04 -P ubuntu-16.04=catthehacker/ubuntu:act-16.04 Build info: Go version: go1.20.8 Module path: github.com/nektos/act Main version: (devel) Main path: github.com/nektos/act Main checksum: Build settings: -buildmode: exe -compiler: gc -ldflags: -s -w -X main.version=0.2.52 -X main.commit=44ea01c2097eaad1596f4dafd6ec84872bd00402 -X main.date=2023-10-01T02:15:30Z -X main.builtBy=goreleaser CGO_ENABLED: 0 GOARCH: amd64 GOOS: linux GOAMD64: v1 vcs: git vcs.revision: 44ea01c2097eaad1596f4dafd6ec84872bd00402 vcs.time: 2023-10-01T02:15:05Z vcs.modified: false Docker Engine: Engine version: 24.0.6 Engine runtime: runc Cgroup version: 2 Cgroup driver: systemd Storage driver: btrfs Registry URI: https://index.docker.io/v1/ OS: Arch Linux OS type: linux OS version: OS arch: x86_64 OS kernel: 6.5.5-zen1-1-zen OS CPU: 8 OS memory: 15707 MB Security options: name=seccomp,profile=builtin name=cgroupns ``` ### Command used with act ```sh act -P ubuntu-latest=catthehacker/ubuntu:act-latest -W .github/workflows/act-github-run-attempt.yml -v ``` ### Describe issue The [`github` context](https://docs.github.com/en/actions/learn-github-actions/contexts#github-context) `run_attempt` property is not set while it should be at least `0` ### Link to GitHub repository _No response_ ### Workflow content ```yml name: Test github.run_attempt on: push: pull_request: env: WORKFLOW_VALUES: ${{ github.run_number }}-${{ github.run_attempt }} jobs: test: runs-on: ubuntu-latest env: JOB_VALUES: ${{ github.run_number }}-${{ github.run_attempt }} steps: - run: | echo $WORKFLOW_VALUES echo $JOB_VALUES echo $STEP_VALUES env: STEP_VALUES: ${{ github.run_number }}-${{ github.run_attempt }} ``` ### Relevant log output ```sh DEBU[0000] Loading environment from /workspace/.env DEBU[0000] Loading action inputs from /workspace/.input DEBU[0000] Loading secrets from /workspace/.secrets DEBU[0000] Loading vars from /workspace/.vars DEBU[0000] Evaluated matrix inclusions: map[] DEBU[0000] Loading workflow '/workspace/.github/workflows/act-gitb-context-in-env.yml' DEBU[0000] Reading workflow '/workspace/.github/workflows/act-gitb-context-in-env.yml' DEBU[0000] Preparing plan with all jobs DEBU[0000] Using default workflow event: push DEBU[0000] Planning jobs for event: push DEBU[0000] Conditional GET for notices etag=c2a8a6e2-b4ff-4ed4-b73f-e8416792e69e DEBU[0000] gc: 2023-10-05 12:34:36.178296307 +0200 CEST m=+0.005777167 module=artifactcache DEBU[0000] Plan Stages: [0xc0003a06a8] DEBU[0000] Stages Runs: [test] DEBU[0000] Job.Name: test DEBU[0000] Job.RawNeeds: {0 0 <nil> [] 0 0} DEBU[0000] Job.RawRunsOn: {8 0 !!str ubuntu-latest <nil> [] 12 14} DEBU[0000] Job.Env: {4 0 !!map <nil> [0xc0003c1ea0 0xc0003c1f40] 14 7} DEBU[0000] Job.If: {0 0 success() <nil> [] 0 0} DEBU[0000] Job.Steps: echo $WORKFLOW_VALUES echo $JOB_VALUES echo $STEP_VALUES DEBU[0000] Job.TimeoutMinutes: DEBU[0000] Job.Services: map[] DEBU[0000] Job.Strategy: <nil> DEBU[0000] Job.RawContainer: {0 0 <nil> [] 0 0} DEBU[0000] Job.Defaults.Run.Shell: DEBU[0000] Job.Defaults.Run.WorkingDirectory: DEBU[0000] Job.Outputs: map[] DEBU[0000] Job.Uses: DEBU[0000] Job.With: map[] DEBU[0000] Job.Result: DEBU[0000] Empty Strategy, matrixes=[map[]] DEBU[0000] Job Matrices: [map[]] DEBU[0000] Runner Matrices: map[] DEBU[0000] Final matrix after applying user inclusions '[map[]]' DEBU[0000] Loading revision from git directory DEBU[0000] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc DEBU[0000] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc' DEBU[0000] using github ref: refs/heads/my/branch DEBU[0000] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc DEBU[0000] Detected CPUs: 8 [Test github.run_attempt/test] [DEBUG] evaluating expression 'success()' [Test github.run_attempt/test] [DEBUG] expression 'success()' evaluated to 'true' [Test github.run_attempt/test] 🚀 Start image=catthehacker/ubuntu:act-latest [Test github.run_attempt/test] 🐳 docker pull image=catthehacker/ubuntu:act-latest platform= username= forcePull=true [Test github.run_attempt/test] [DEBUG] 🐳 docker pull catthehacker/ubuntu:act-latest [Test github.run_attempt/test] [DEBUG] pulling image 'docker.io/catthehacker/ubuntu:act-latest' () [Test github.run_attempt/test] using DockerAuthConfig authentication for docker pull DEBU[0000] Saving notices etag=c2a8a6e2-b4ff-4ed4-b73f-e8416792e69e DEBU[0000] No new notices [Test github.run_attempt/test] [DEBUG] Pulling from catthehacker/ubuntu :: act-latest [Test github.run_attempt/test] [DEBUG] Digest: sha256:58fe9a3572dfd9e1ef9294e1fd969620955d20b045be0960d294b963e112f14c :: [Test github.run_attempt/test] [DEBUG] Status: Image is up to date for catthehacker/ubuntu:act-latest :: [Test github.run_attempt/test] 🐳 docker create image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] [Test github.run_attempt/test] [DEBUG] Common container.Config ==> &{Hostname: Domainname: User: AttachStdin:false AttachStdout:false AttachStderr:false ExposedPorts:map[] Tty:true OpenStdin:false StdinOnce:false Env:[RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_ARCH=X64 RUNNER_TEMP=/tmp LANG=C.UTF-8] Cmd:[] Healthcheck:<nil> ArgsEscaped:false Image:catthehacker/ubuntu:act-latest Volumes:map[] WorkingDir:/workspace Entrypoint:[] NetworkDisabled:false MacAddress: OnBuild:[] Labels:map[] StopSignal: StopTimeout:<nil> Shell:[]} [Test github.run_attempt/test] [DEBUG] Common container.HostConfig ==> &{Binds:[/var/run/docker.sock:/var/run/docker.sock] ContainerIDFile: LogConfig:{Type: Config:map[]} NetworkMode:host PortBindings:map[] RestartPolicy:{Name: MaximumRetryCount:0} AutoRemove:false VolumeDriver: VolumesFrom:[] ConsoleSize:[0 0] Annotations:map[] CapAdd:[] CapDrop:[] CgroupnsMode: DNS:[] DNSOptions:[] DNSSearch:[] ExtraHosts:[] GroupAdd:[] IpcMode: Cgroup: Links:[] OomScoreAdj:0 PidMode: Privileged:false PublishAllPorts:false ReadonlyRootfs:false SecurityOpt:[] StorageOpt:map[] Tmpfs:map[] UTSMode: UsernsMode: ShmSize:0 Sysctls:map[] Runtime: Isolation: Resources:{CPUShares:0 Memory:0 NanoCPUs:0 CgroupParent: BlkioWeight:0 BlkioWeightDevice:[] BlkioDeviceReadBps:[] BlkioDeviceWriteBps:[] BlkioDeviceReadIOps:[] BlkioDeviceWriteIOps:[] CPUPeriod:0 CPUQuota:0 CPURealtimePeriod:0 CPURealtimeRuntime:0 CpusetCpus: CpusetMems: Devices:[] DeviceCgroupRules:[] DeviceRequests:[] KernelMemory:0 KernelMemoryTCP:0 MemoryReservation:0 MemorySwap:0 MemorySwappiness:<nil> OomKillDisable:<nil> PidsLimit:<nil> Ulimits:[] CPUCount:0 CPUPercent:0 IOMaximumIOps:0 IOMaximumBandwidth:0} Mounts:[{Type:volume Source:act-Test-github-run-attempt-test-9da691d3342549b99b1d0c82baed9ecf973ad03dc91d9d874f0837c54d9bb81d Target:/workspace ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>} {Type:volume Source:act-toolcache Target:/toolcache ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>} {Type:volume Source:act-Test-github-run-attempt-test-9da691d3342549b99b1d0c82baed9ecf973ad03dc91d9d874f0837c54d9bb81d-env Target:/var/run/act ReadOnly:false Consistency: BindOptions:<nil> VolumeOptions:<nil> TmpfsOptions:<nil> ClusterOptions:<nil>}] MaskedPaths:[] ReadonlyPaths:[] Init:<nil>} [Test github.run_attempt/test] [DEBUG] Created container name=act-Test-github-run-attempt-test-9da691d3342549b99b1d0c82baed9ecf973ad03dc91d9d874f0837c54d9bb81d id=e63c9cb3aa22e22068d972e0975553d5b3b76124de62689ab9158bf5b5d71eb7 from image catthehacker/ubuntu:act-latest (platform: ) [Test github.run_attempt/test] [DEBUG] ENV ==> [RUNNER_TOOL_CACHE=/opt/hostedtoolcache RUNNER_OS=Linux RUNNER_ARCH=X64 RUNNER_TEMP=/tmp LANG=C.UTF-8] [Test github.run_attempt/test] 🐳 docker run image=catthehacker/ubuntu:act-latest platform= entrypoint=["tail" "-f" "/dev/null"] cmd=[] [Test github.run_attempt/test] [DEBUG] Starting container: e63c9cb3aa22e22068d972e0975553d5b3b76124de62689ab9158bf5b5d71eb7 [Test github.run_attempt/test] [DEBUG] Started container: e63c9cb3aa22e22068d972e0975553d5b3b76124de62689ab9158bf5b5d71eb7 [Test github.run_attempt/test] [DEBUG] Writing entry to tarball workflow/event.json len:2 [Test github.run_attempt/test] [DEBUG] Writing entry to tarball workflow/envs.txt len:0 [Test github.run_attempt/test] [DEBUG] Extracting content to '/var/run/act/' [Test github.run_attempt/test] [DEBUG] Loading revision from git directory [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc' [Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] expression '${{ github.run_number }}-${{ github.run_attempt }}' rewritten to 'format('{0}-{1}', github.run_number, github.run_attempt)' [Test github.run_attempt/test] [DEBUG] evaluating expression 'format('{0}-{1}', github.run_number, github.run_attempt)' [Test github.run_attempt/test] [DEBUG] expression 'format('{0}-{1}', github.run_number, github.run_attempt)' evaluated to '%!t(string=1-)' [Test github.run_attempt/test] [DEBUG] expression '${{ github.run_number }}-${{ github.run_attempt }}' rewritten to 'format('{0}-{1}', github.run_number, github.run_attempt)' [Test github.run_attempt/test] [DEBUG] evaluating expression 'format('{0}-{1}', github.run_number, github.run_attempt)' [Test github.run_attempt/test] [DEBUG] expression 'format('{0}-{1}', github.run_number, github.run_attempt)' evaluated to '%!t(string=1-)' [Test github.run_attempt/test] [DEBUG] Loading revision from git directory [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc' [Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] Loading revision from git directory [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc' [Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] expression '${{ github.run_number }}-${{ github.run_attempt }}' rewritten to 'format('{0}-{1}', github.run_number, github.run_attempt)' [Test github.run_attempt/test] [DEBUG] evaluating expression 'format('{0}-{1}', github.run_number, github.run_attempt)' [Test github.run_attempt/test] [DEBUG] expression 'format('{0}-{1}', github.run_number, github.run_attempt)' evaluated to '%!t(string=1-)' [Test github.run_attempt/test] [DEBUG] Loading revision from git directory [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc' [Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] setupEnv => map[ACT:true ACTIONS_CACHE_URL:http://192.168.10.142:33401/ CI:true GITHUB_ACTION:0 GITHUB_ACTIONS:true GITHUB_ACTION_PATH: GITHUB_ACTION_REF: GITHUB_ACTION_REPOSITORY: GITHUB_ACTOR:nektos/act GITHUB_API_URL:https://api.github.com GITHUB_BASE_REF: GITHUB_EVENT_NAME:push GITHUB_EVENT_PATH:/var/run/act/workflow/event.json GITHUB_GRAPHQL_URL:https://api.github.com/graphql GITHUB_HEAD_REF: GITHUB_JOB:test GITHUB_REF:refs/heads/my/branch GITHUB_REF_NAME:my/branch GITHUB_REF_TYPE:branch GITHUB_REPOSITORY:me/actions GITHUB_REPOSITORY_OWNER:me GITHUB_RETENTION_DAYS:0 GITHUB_RUN_ID:1 GITHUB_RUN_NUMBER:1 GITHUB_SERVER_URL:https://github.com GITHUB_SHA:a9bd00a9c9a9a615b84b016c2faddf962e3411dc GITHUB_TOKEN: GITHUB_WORKFLOW:Test github.run_attempt GITHUB_WORKSPACE:/workspace ImageOS:ubuntu20 JOB_VALUES:1- RUNNER_PERFLOG:/dev/null RUNNER_TRACKING_ID: STEP_VALUES:1- WORKFLOW_VALUES:1-] [Test github.run_attempt/test] [DEBUG] Loading revision from git directory [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc' [Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] Loading revision from git directory [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc' [Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] evaluating expression '' [Test github.run_attempt/test] [DEBUG] expression '' evaluated to 'true' [Test github.run_attempt/test] ⭐ Run Main echo $WORKFLOW_VALUES echo $JOB_VALUES echo $STEP_VALUES [Test github.run_attempt/test] [DEBUG] Writing entry to tarball workflow/outputcmd.txt len:0 [Test github.run_attempt/test] [DEBUG] Writing entry to tarball workflow/statecmd.txt len:0 [Test github.run_attempt/test] [DEBUG] Writing entry to tarball workflow/pathcmd.txt len:0 [Test github.run_attempt/test] [DEBUG] Writing entry to tarball workflow/envs.txt len:0 [Test github.run_attempt/test] [DEBUG] Writing entry to tarball workflow/SUMMARY.md len:0 [Test github.run_attempt/test] [DEBUG] Extracting content to '/var/run/act' [Test github.run_attempt/test] [DEBUG] Loading revision from git directory [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc' [Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] Loading revision from git directory [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc' [Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] Loading revision from git directory [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc' [Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] Loading revision from git directory [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc' [Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] Wrote command echo $WORKFLOW_VALUES echo $JOB_VALUES echo $STEP_VALUES to 'workflow/0' [Test github.run_attempt/test] [DEBUG] Writing entry to tarball workflow/0 len:59 [Test github.run_attempt/test] [DEBUG] Extracting content to '/var/run/act' [Test github.run_attempt/test] 🐳 docker exec cmd=[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0] user= workdir= [Test github.run_attempt/test] [DEBUG] Exec command '[bash --noprofile --norc -e -o pipefail /var/run/act/workflow/0]' [Test github.run_attempt/test] [DEBUG] Working directory '/workspace' | 1- | 1- | 1- [Test github.run_attempt/test] ✅ Success - Main echo $WORKFLOW_VALUES echo $JOB_VALUES echo $STEP_VALUES [Test github.run_attempt/test] [DEBUG] Removed container: e63c9cb3aa22e22068d972e0975553d5b3b76124de62689ab9158bf5b5d71eb7 [Test github.run_attempt/test] [DEBUG] 🐳 docker volume rm act-Test-github-run-attempt-test-9da691d3342549b99b1d0c82baed9ecf973ad03dc91d9d874f0837c54d9bb81d [Test github.run_attempt/test] [DEBUG] 🐳 docker volume rm act-Test-github-run-attempt-test-9da691d3342549b99b1d0c82baed9ecf973ad03dc91d9d874f0837c54d9bb81d-env [Test github.run_attempt/test] 🏁 Job succeeded [Test github.run_attempt/test] [DEBUG] Loading revision from git directory [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc [Test github.run_attempt/test] [DEBUG] HEAD points to 'a9bd00a9c9a9a615b84b016c2faddf962e3411dc' [Test github.run_attempt/test] [DEBUG] using github ref: refs/heads/my/branch [Test github.run_attempt/test] [DEBUG] Found revision: a9bd00a9c9a9a615b84b016c2faddf962e3411dc ``` ### Additional information Having `github.run_attempt` always set 0 should fix it. Providing a way to set it from the command line (eg. like `--attempt=3`) could be a good bonus allowing to test workflow retry
kerem 2026-03-01 21:47:51 +03:00
Author
Owner

@github-actions[bot] commented on GitHub (Apr 3, 2024):

Issue is stale and will be closed in 14 days unless there is new activity

<!-- gh-comment-id:2033309365 --> @github-actions[bot] commented on GitHub (Apr 3, 2024): Issue is stale and will be closed in 14 days unless there is new activity
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#975
No description provided.