Looks like you're not quite sure where your repository code is mounted/placed in your GitHub hosted VM.
From the GitHub Actions Docs:
https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners (the table I copied and pasted doesn't format well below so if you're confused, click on the link)
Filesystems on GitHub-hosted runners GitHub executes actions and shell
commands in specific directories on the virtual machine. The file
paths on virtual machines are not static. Use the environment
variables GitHub provides to construct file paths for the home,
workspace, and workflow directories.
Directory Environment variable Description
home HOME Contains user-related data. For example, this directory
could contain credentials from a login attempt.
workspace GITHUB_WORKSPACE Actions and shell commands execute in this
directory. An action can modify the contents of this directory, which
subsequent actions can access.
I just glanced at s3cmd --help
Usage: s3cmd [options] COMMAND [parameters]
S3cmd is a tool for managing objects in Amazon S3 storage. It allows for
making and removing "buckets" and uploading, downloading and removing
"objects" from these buckets.
Options:
...
-c FILE, --config=FILE
Config file name. Defaults to $HOME/.s3cfg
It looks like s3cmd is looking for its configuration file at $HOME/.s3cfg
, but since your repository is located at $GITHUB_WORKSPACE
your file is really located at: $GITHUB_WORKSPACE/.s3cfg
I would try using the -c
flag with s3cmd to specify the location of your .s3cfg
file.
Ex:
- name: Upload a simple text file to s3
run: sudo s3cmd -c "$GITHUB_WORKSPACE/.s3cmd" put src/taka.txt s3://ashik-test -P
- btw I'm not sure why you need to use
sudo
here, my guess is you probably don't need it.
- Tip: You can use the GitHub action "Debugging with tmate" to "poke around" inside your runner/VM if you're confused about where things are or if you want to interactively try things. https://github.com/marketplace/actions/debugging-with-tmate