Let's say the integration tests I want to run on every pull requests require an external API authentication secret.
See the following example:
name: Pull Request Workflow
on:
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build and test
run: |
# Build and test code here
./run-tests.sh --secret=$MY_SECRET
# Use ${{ secrets.MY_SECRET }} to access the encrypted secret
env:
MY_SECRET: ${{ secrets.MY_SECRET }}
It is important for me to have contributors see the results of these tests and solve the potential issues before a pull request is merged.
On the other hand, if a malicious contributor can to steal the secret, he/she will change run-tests.sh
to send the secret back to him/her and open a pull request.
What is the right way to protect the secrets in such case? Seems like basic to give test feedback on pull requests.