在使用 Github 操作时,我面临着 "Permission denied error"

While using Github Actions, I'm facing "Permission denied error"

我最近正在处理 Github 操作,在将 .p12 证书导入 build.keychain 时遇到问题,并收到如下错误:

/Users/runner/work/_temp/47c4b40a-b302-4da8-a26c-562eaae4c0ee.sh: line 1: ./provisioning/import_provisioning.sh: Permission denied
Error: Process completed with exit code 1.

经过几个小时的努力,我什至尝试在我的终端上手动 运行 这个脚本,一切似乎都运行良好!我重新检查了我的密码是否错误或我是否无法访问它!但我认为我能够正确访问我的 github 秘密,知道为什么会发生这种情况!

这是我的 shell 脚本文件 import_provisioning.sh

gpg --quiet --batch --yes --decrypt --passphrase="$PROVISIONING_PASSWORD" --output provisioning/AppStoreCertificates.p12 provisioning/AppStoreCertificates.p12.gpg
gpg --quiet --batch --yes --decrypt --passphrase="$PROVISIONING_PASSWORD" --output provisioning/demo.mobileprovision provisioning/demo.mobileprovision.gpg

mkdir -p ~/Library/MobileDevice/Provisioning\ Profiles

echo "List profiles"
ls ~/Library/MobileDevice/Provisioning\ Profiles/
echo "Move profiles"
cp provisioning/*.mobileprovision ~/Library/MobileDevice/Provisioning\ Profiles/
echo "List profiles"
ls ~/Library/MobileDevice/Provisioning\ Profiles/

security create-keychain -p "" build.keychain
security import provisioning/AppStoreCertificates.p12 -t agg -k ~/Library/Keychains/build.keychain -P "$PROVISIONING_PASSWORD" -A

security list-keychains -s ~/Library/Keychains/build.keychain
security default-keychain -s ~/Library/Keychains/build.keychain
security unlock-keychain -p "" ~/Library/Keychains/build.keychain
security set-key-partition-list -S apple-tool:,apple: -s -k "" ~/Library/Keychains/build.keychain

以防万一您没有正确获取它,您可以检查 github 存储库以供参考 https://github.com/dheerajghub/GithubPipeline/blob/master/provisioning/import_provisioning.sh

我刚发现问题出在文件权限上,所以我设置了文件权限,一切似乎都正常!

git update-index --chmod=+x provisioning/import_provisioning.sh
git commit -m "Changing file permissions"