diff --git a/.github/actions/github-download-file/action.yml b/.github/actions/github-download-file/action.yml new file mode 100644 index 000000000..108c0d4d5 --- /dev/null +++ b/.github/actions/github-download-file/action.yml @@ -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 }} diff --git a/.github/dependabot.yml b/.github/dependabot.yml index bc7b78ac2..73619ad86 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -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: diff --git a/docs/README.md b/docs/README.md index 45210e592..e33adf0aa 100644 --- a/docs/README.md +++ b/docs/README.md @@ -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) @@ -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 diff --git a/update-dependabot.sh b/update-dependabot.sh index 0f7eb2070..778f29038 100755 --- a/update-dependabot.sh +++ b/update-dependabot.sh @@ -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 diff --git a/version.txt b/version.txt index 268fccb19..7aefc8246 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v5.5.0 +v5.6.0