Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission Denied Error and Missing Config File Handling in Template Setup #564

Open
oop7 opened this issue Jan 6, 2025 · 0 comments
Open

Comments

@oop7
Copy link

oop7 commented Jan 6, 2025

Hi [j-hc],

I encountered an issue while using the repository as a template (not a fork). The problem occurs during the GitHub Actions workflow build process, specifically related to:

  1. Permission Denied for bin/toml/tq-x86_64:
    The script fails because the bin/toml/tq-x86_64 executable does not have the necessary execute permissions.

  2. Missing Config File Handling:
    The script attempts to use config.toml as a fallback when config.json is not found, but it does not handle the case where neither file exists, leading to an unclear error message.

Interestingly, this issue does not occur when I fork the original repository and test it. It seems to be specific to the template setup.


Error Log:

Here’s the exact error I encountered in the GitHub Actions workflow:

Run if [ -f "config.json" ]; then ./build.sh config.json; else ./build.sh config.toml; fi
  if [ -f "config.json" ]; then ./build.sh config.json; else ./build.sh config.toml; fi
  shell: /usr/bin/bash -e {0}
  env:
    JAVA_HOME: /opt/hostedtoolcache/Java_Zulu_jdk/17.0.13-11/x64
    JAVA_HOME_17_X64: /opt/hostedtoolcache/Java_Zulu_jdk/17.0.13-11/x64
    GITHUB_TOKEN: ***
    GITHUB_REPOSITORY: $GITHUB_REPOSITORY
    NEXT_VER_CODE: 4
utils.sh: line 16: bin/toml/tq-x86_64: Permission denied
[-] ABORT: could not find config file 'config.toml'
Error: utils.sh [-] ABORT: could not find config file 'config.toml'
	Usage: ./build.sh <config.toml>
	Usage: ./build.sh <config.toml>
Error: Process completed with exit code 1.

Fix Applied:

I resolved the issue by adding the following code to the build script:

# Fix permissions for tq-x86_64
chmod +x bin/toml/tq-x86_64

# Check for config files and run the build script
if [ -f "config.json" ]; then
    ./build.sh config.json
elif [ -f "config.toml" ]; then
    ./build.sh config.toml
else
    echo "[-] ABORT: No config file found (config.json or config.toml)"
    exit 1
fi

This fix:

  1. Ensures bin/toml/tq-x86_64 has the correct execute permissions.
  2. Provides a clear error message if neither config.json nor config.toml is found.

Questions:

  1. Is this issue specific to the template setup, or is there a better way to handle it?
  2. Should the template include additional instructions or checks to prevent this issue?

Additional Context:

  • The issue occurs in the GitHub Actions workflow when using the repository as a template.
  • The issue does not occur when forking and testing the original repository.
  • The fix has been tested and works as expected in my template setup.

Thank you for your time and for maintaining this project! Let me know if you need any additional information.

Best regards,
[oop7]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant