-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
93297c3
commit eec48bc
Showing
4 changed files
with
7,288 additions
and
1,919 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
name: S3-synchronization-cronjob | ||
|
||
on: | ||
schedule: | ||
- cron: '0 8 * * *' # Everyday at 8am | ||
|
||
jobs: | ||
sync: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: master | ||
token: ${{ secrets.GH_TOKEN }} | ||
- name: Generate random number | ||
id: random | ||
run: echo "::set-output name=value::$(echo $RANDOM)" | ||
- name: Get current date | ||
id: date | ||
run: echo "::set-output name=date::$(date +'%Y-%m-%d')" | ||
- name: Create branch | ||
uses: peterjgrainger/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} | ||
with: | ||
branch: sync-${{ steps.random.outputs.value }} | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: sync-${{ steps.random.outputs.value }} | ||
token: ${{ secrets.GH_TOKEN }} | ||
- name: create env file | ||
run: | | ||
touch .env | ||
echo AWS_STARPORT_BAR_AK=${{ secrets.AWS_STARPORT_BAR_AK }} >> .env | ||
echo AWS_STARPORT_BAR_SAK=${{ secrets.AWS_STARPORT_BAR_SAK }} >> .env | ||
echo REPOSITORY_ID=${{ secrets.REPOSITORY_ID }} >> .env | ||
- name: Use Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '18.x' | ||
- run: npm install | ||
- run: npm run sync-script | ||
- name: commit and push new file | ||
run: | | ||
git config --global user.name "S3 Synchronization Cronjob" | ||
git config --global user.email "<>" | ||
git add . | ||
git commit --allow-empty -m "Cronjob/Sync docs folder with s3" | ||
git push | ||
- name: create pull request | ||
run: | | ||
gh pr create -B master -H sync-${{ steps.random.outputs.value }} --title 'Cronjob/Sync docs folder with s3' --body 'Created by Github action' | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} |
Oops, something went wrong.