use exec to force #16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Testing and Linting - Create Secret from .env | |
on: | |
push: | |
branches: | |
- main | |
paths-ignore: | |
- "*.md" | |
pull_request: | |
branches: | |
- main | |
jobs: | |
shellcheck: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install ShellCheck | |
run: sudo apt-get install shellcheck -y | |
- name: Run ShellCheck | |
run: shellcheck gh-env-to-repo | |
creating_secret: | |
runs-on: ubuntu-latest | |
needs: shellcheck | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install gh extension and create secret | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "🚀 Install: gh-env-to-repo" | |
if [[ ! $EXTENSIONS == *"gh-env-to-repo"* ]]; then | |
gh extension install endersonmenezes/gh-env-to-repo | |
else | |
gh extension upgrade gh-env-to-repo | |
fi | |
echo "🔑 Create secret" | |
gh extension exec env-to-repo endersonmenezes gh-env-to-repo | |
proof-of-concept: | |
runs-on: ubuntu-latest | |
needs: creating_secret | |
steps: | |
- name: Verify secret | |
run: | | |
if [ -z "${{ secrets.TEST }}" ]; then | |
echo "Secret not found" | |
exit 1 | |
else | |
echo "Secret found" | |
fi | |
if [ "${{ secrets.TEST }}" != "TEST" ]; then | |
echo "Secret value is not TEST" | |
exit 1 | |
else | |
echo "Secret value is TEST" | |
fi | |
if [ -z "${{ secrets.TEST_WITH_QUOTES }}" ]; then | |
echo "Secret with quotes not found" | |
exit 1 | |
else | |
echo "Secret with quotes found" | |
fi | |
if [ "${{ secrets.TEST_WITH_QUOTES }}" != "TEST" ]; then | |
echo "Secret with quotes value is not TEST" | |
exit 1 | |
else | |
echo "Secret with quotes value is TEST" | |
fi |