[英]Download file from s3 then store the files into the github repository
I have files stored in an AWS S3 bucket.我将文件存储在 AWS S3 存储桶中。 I would like to use GitHub actions to download those files and put them into my GitHub repository.我想使用 GitHub 操作来下载这些文件并将它们放入我的 GitHub 存储库中。 Furthermore, I am able to download the files, but I cannot seem to get the files to then go into my repository.此外,我可以下载文件,但我似乎无法将文件然后 go 放入我的存储库。 Here are the attempts I have made.这是我所做的尝试。
steps:
- name: Download from S3
run: |
aws s3 cp --recursive aws-bucket myDirectoryIWantTheFilesIn
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: 'us-east-1'
I have tried as well with the aws-s3-github-actions我也尝试过 aws-s3-github-actions
- name: copy sitemaps
uses: keithweaver/aws-s3-github-action@v1.0.0
with:
command: cp
source: awsS3Bucket
destination: myDirectoryIWantTheFilesIn
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-1
flags: --recursive
I needed to include the action's checkout and then commit it.我需要包含操作的结帐,然后提交。
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
# This is a basic workflow to help you get started with Actions
name: Fetch data.
# Controls when the workflow will run
on:
schedule:
# Runs "at hour 6 past every day" (see https://crontab.guru)
- cron: '00 6 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: keithweaver/aws-s3-github-action@v1.0.0 # Verifies the recursive flag
name: cp folder
with:
command: cp
source: myBucket
destination: myDestination
aws_access_key_id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws_secret_access_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws_region: us-east-1
flags: --recursive
- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git diff-index --quiet HEAD || git commit -m "MyCommitMessage" -a
git push origin master
You can mark this as duplicate您可以将此标记为重复
You may have your answer here你可能在这里得到答案
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.