Skip to content

Merge pull request #9 from mmichaelb/renovate/actions-checkout-digest #39

Merge pull request #9 from mmichaelb/renovate/actions-checkout-digest

Merge pull request #9 from mmichaelb/renovate/actions-checkout-digest #39

Workflow file for this run

name: Test action
on: [ push ]
jobs:
test-action-print-variables:
runs-on: ubuntu-22.04
permissions:
actions: read
env:
SOPS_AGE_KEY: ${{ secrets.SOPS_AGE_KEY }}
outputs:
job_id: ${{ steps.print_sensitive_variables.outputs.job_id }}
steps:
- name: Checkout code
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4
- name: Add masks for sops values
uses: ./
with:
sops-file: ./test_assets/secrets.json
sops-age-key: ${{ secrets.SOPS_AGE_KEY }}
- name: Get Current Job Log URL
uses: Tiryoh/gha-jobid-action@v1
id: jobs
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
job_name: "${{ github.job }}"
- name: Print some sensitive variables
id: print_sensitive_variables
run: |
echo "User password:Summer2019"
echo "Oh no hopefully nobody finds this sensitive value: donotfindthissupersecretstring! That would be a catastrophe!"
echo "job_id=${{ steps.jobs.outputs.job_id }}" >> $GITHUB_OUTPUT
shell: bash
test-action-check-logs:
runs-on: ubuntu-22.04
permissions:
actions: read
needs:
- test-action-print-variables
steps:
- name: Retrieve the workflow run
env:
PREVIOUS_JOB_ID: ${{ needs.test-action-print-variables.outputs.job_id }}
run: |
echo "previous job id: $PREVIOUS_JOB_ID"
job_log=$(curl --request GET -L \
--url "https://api.github.com/repos/${{ github.repository }}/actions/jobs/$PREVIOUS_JOB_ID/logs" \
--header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' \
--header 'content-type: application/vnd.github+json' \
--fail)
if echo $job_log | grep "donotfindthissupersecretstring\!"; then
echo "found sensitive value \"donotfindthissupersecretstring!\" in job log!"
exit 1
fi
if echo $job_log | grep "Summer2019"; then
echo "found sensitive value \"Summer2019\" in job log!"
exit 1
fi
shell: bash