Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ACS-5142 Add file retrieval action #426

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions .github/actions/github-download-file/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: "Github Download File"
description: "Download a file from another repository"
inputs:
token:
description: "GitHub Access Token"
required: true
repository:
description: "The owner and repository name from which the file should be downloaded. For example, octocat/Hello-World."
required: true
file-path:
description: "Path to the file you want to download"
required: true
target:
description: "Where and with what name to save the file"
required: true
runs:
using: "composite"
steps:
- name: "Download file"
shell: bash
env:
GITHUB_TOKEN: ${{ inputs.token }}
run: |
export API_URL=https://api.github.com/repos/${{ inputs.repository }}/contents/${{ inputs.file-path }}
gh api $API_URL -H "Accept: application/vnd.github.raw" >> ${{ inputs.target }}
4 changes: 4 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,10 @@ updates:
directory: "/.github/actions/git-latest-tag"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/.github/actions/github-download-file"
schedule:
interval: "weekly"
- package-ecosystem: "github-actions"
directory: "/.github/actions/helm-build-chart"
schedule:
Expand Down
14 changes: 14 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ Here follows the list of GitHub Actions topics available in the current document
- [get-commit-message](#get-commit-message)
- [git-commit-changes](#git-commit-changes)
- [git-latest-tag](#git-latest-tag)
- [github-download-file](#github-download-file)
- [helm-build-chart](#helm-build-chart)
- [helm-integration-tests](#helm-integration-tests)
- [helm-package-chart](#helm-package-chart)
Expand Down Expand Up @@ -491,6 +492,19 @@ Gets the latest tag and commit sha for the given pattern. The result is returned
pattern: 1.0.0-alpha*
```

### github-download-file

Download a file from another repository.

```yaml
- uses: Alfresco/alfresco-build-tools/.github/actions/download-file@ref
with:
github-token: ${{ secrets.BOT_GITHUB_TOKEN }}
repository: "owner/repository"
file-path: "subdirectory/file-name.json"
target: "downloaded-file.json"
```

### helm-build-chart

Run `helm dep up` and `helm lint` on the specified chart
Expand Down
2 changes: 1 addition & 1 deletion update-dependabot.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ echo "version: 2" > "$temp_config"
echo "updates:" >> "$temp_config"

# Loop through composite actions and append to temp config
for action_filename in $(find "$actions_dir" -mindepth 2 -type f -name action.yml | sort -n); do
for action_filename in $(find "$actions_dir" -mindepth 2 -type f -name action.yml | env -i LC_COLLATE=C sort -n); do
action_dir=$(dirname $action_filename)
generate_dependabot_section "$action_dir" >> "$temp_config"
done
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v5.5.0
v5.6.0
Loading