|
41 | 41 | original_sha=$(cat ./artifacts/parent-artifacts/sha.txt)
|
42 | 42 | original_ref=$(cat ./artifacts/parent-artifacts/ref.txt)
|
43 | 43 | original_conclusion=$(cat ./artifacts/parent-artifacts/conclusion.txt)
|
| 44 | +
|
| 45 | + # Sanitize the values to avoid security issues |
| 46 | +
|
| 47 | + # Event: Allow alphabetical characters and underscores |
| 48 | + original_event=$(echo "$original_event" | tr -cd '[:alpha:]_') |
| 49 | +
|
| 50 | + # Action: Allow alphabetical characters and underscores |
| 51 | + original_action=$(echo "$original_action" | tr -cd '[:alpha:]_') |
| 52 | +
|
| 53 | + # SHA: Allow alphanumeric characters |
| 54 | + original_sha=$(echo "$original_sha" | tr -cd '[:alnum:]') |
| 55 | +
|
| 56 | + # Ref: Allow alphanumeric characters, slashes, underscores, dots, and dashes |
| 57 | + original_ref=$(echo "$original_ref" | tr -cd '[:alnum:]/_.-') |
| 58 | +
|
| 59 | + # Conclusion: Allow alphabetical characters and underscores |
| 60 | + original_conclusion=$(echo "$original_conclusion" | tr -cd '[:alpha:]_') |
| 61 | +
|
44 | 62 | echo "original_event=$original_event" >> $GITHUB_ENV
|
45 | 63 | echo "original_action=$original_action" >> $GITHUB_ENV
|
46 | 64 | echo "original_sha=$original_sha" >> $GITHUB_ENV
|
@@ -71,10 +89,10 @@ jobs:
|
71 | 89 | uses: actions/github-script@v7
|
72 | 90 | with:
|
73 | 91 | script: |
|
74 |
| - const ref = '${{ env.original_ref }}'; |
| 92 | + const ref = process.env.original_ref; |
75 | 93 | const key_prefix = 'tests-' + ref + '-';
|
76 | 94 |
|
77 |
| - if ('${{ env.original_event }}' == 'pull_request' && '${{ env.original_action }}' != 'closed') { |
| 95 | + if (process.env.original_event == 'pull_request' && process.env.original_action != 'closed') { |
78 | 96 | console.log('Skipping cache cleanup for open PR');
|
79 | 97 | return;
|
80 | 98 | }
|
@@ -104,12 +122,12 @@ jobs:
|
104 | 122 | script: |
|
105 | 123 | const owner = '${{ github.repository_owner }}';
|
106 | 124 | const repo = '${{ github.repository }}'.split('/')[1];
|
107 |
| - const sha = '${{ env.original_sha }}'; |
| 125 | + const sha = process.env.original_sha; |
108 | 126 | core.debug(`owner: ${owner}`);
|
109 | 127 | core.debug(`repo: ${repo}`);
|
110 | 128 | core.debug(`sha: ${sha}`);
|
111 | 129 | const { context: name, state } = (await github.rest.repos.createCommitStatus({
|
112 |
| - context: 'Runtime Tests / Report results (${{ env.original_event }} -> workflow_run -> workflow_run)', |
| 130 | + context: `Runtime Tests / Report results (${process.env.original_event} -> workflow_run -> workflow_run)`, |
113 | 131 | owner: owner,
|
114 | 132 | repo: repo,
|
115 | 133 | sha: sha,
|
|
0 commit comments