Skip to content

Commit 1490fee

Browse files
Add ability to set expiration date from workflow (#36)
* Add ability to set expiration date from workflow * Add ability to set expiration date from workflow * Add ability to set expiration date from workflow * Update get_azure_share_sas/get_azure_share_sas.sh Co-authored-by: George Zubrienko <zubrienkog@gmail.com> Co-authored-by: George Zubrienko <zubrienkog@gmail.com>
1 parent bb32a1a commit 1490fee

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

README.md

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -514,15 +514,17 @@ Generates new temporary
514514
[Shared Access Signature](https://learn.microsoft.com/en-us/azure/storage/common/storage-sas-overview)
515515
for a file share, attached to a storage account.
516516

517-
**NOTES**:
518-
1) The generated SAS is valid for 5 minutes.
519-
520517
### Inputs
521-
| Name | Description | Optional |
522-
|----------------|:-----------------------------------------|----------|
523-
| directory_name | Path within file share | False |
524-
| account_key | Name of the storage account of the share | False |
525-
| account_name | Key of the storage account of the share | False |
518+
| Name | Description | Optional | Default Value |
519+
|-----------------|:-----------------------------------------------------------------|----------|---------------|
520+
| directory_name | Path within file share | False | |
521+
| account_key | Name of the storage account of the share | False | |
522+
| account_name | Key of the storage account of the share | False | |
523+
| expiration_date | Expiration date in format that can be used by the `date` command | True | +10 minutes |
524+
525+
526+
**NOTES**:
527+
1) For the expiration date format see [man 1 date](https://man7.org/linux/man-pages/man1/date.1.html)
526528

527529
### Outputs
528530
| Name | Description |

get_azure_share_sas/action.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ inputs:
1818
description: Storage account name
1919
required: true
2020

21+
expiration_date:
22+
description: Expiration date in format that can be used by date command
23+
required: false
24+
default: "+10 minutes"
25+
2126

2227
outputs:
2328
authorized_destination:
@@ -34,4 +39,5 @@ runs:
3439
DIRECTORY_NAME: ${{ inputs.directory_name }}
3540
ACCOUNT_KEY: ${{ inputs.account_key }}
3641
ACCOUNT_NAME: ${{ inputs.account_name }}
42+
EXPIRATION_DATE: ${{ inputs.expiration_date }}
3743
id: sas

get_azure_share_sas/get_azure_share_sas.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ set -Eeuo pipefail
1818

1919
destination="https://$ACCOUNT_NAME.file.core.windows.net/$DIRECTORY_NAME"
2020

21-
echo "Generating SAS for upload to $destination"
22-
end=$(date -d '+5 minutes' '+%Y-%m-%dT%H:%MZ')
21+
end=$(date -d "$EXPIRATION_DATE" '+%Y-%m-%dT%H:%MZ')
22+
echo "Generating SAS for $destination with expiration date $end"
2323
sas=$(
2424
az storage account generate-sas \
2525
--account-key "$ACCOUNT_KEY" \

0 commit comments

Comments
 (0)