Skip to content

Commit

Permalink
ci: Manually copy files to repo
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Oct 24, 2024
1 parent 43cf678 commit f1065ac
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 29 deletions.
90 changes: 61 additions & 29 deletions .github/workflows/copy-content.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ on:
commit_msg:
required: true
type: string
prerun:
required: false
type: string
secrets:
PAT:
required: true
Expand All @@ -36,39 +39,68 @@ jobs:
env:
GH_TOKEN: ${{ secrets.PAT }}
run: echo "pr_exists=$(gh pr list -R ${{ inputs.repo }} -H ${{ inputs.branch }} --json number -q length)" >> $GITHUB_OUTPUT
- name: Checkout code
- name: Checkout source repo
uses: actions/checkout@v4
with:
path: "source"
- name: Checkout destination repo
uses: actions/checkout@v4
# - name: Pull latest changes
# run: git pull
with:
path: "destination"
repository: ${{ inputs.repo }}
token: ${{ secrets.PAT }}
ref: ${{ inputs.branch }}
- run: echo ${{inputs.prerun}}
- name: Run pre-run command
if: inputs.prerun != ''
run: |
cd destination
eval ${{ inputs.prerun }}
- name: Get current date
id: date
run: echo "date=$(date +%Y-%m-%d)" >> $GITHUB_OUTPUT
- name: Push files if branch exists
uses: dmnemec/copy_file_to_another_repo_action@main
if: ${{ steps.check_branch.outputs.branch_exists != 0 }}
env:
API_TOKEN_GITHUB: ${{ secrets.PAT }}
with:
source_file: ${{ inputs.source_dir }}
destination_repo: ${{ inputs.repo }}
destination_folder: ${{ inputs.destination_dir }}
destination_branch: ${{ inputs.branch }}
user_email: "[email protected]"
user_name: "Zeta Tokens Bot"
commit_message: "deps(automated): ${{inputs.commit_msg}} ${{ steps.date.outputs.date }}"
- name: Push files if branch does not exist
uses: dmnemec/copy_file_to_another_repo_action@main
if: ${{ steps.check_branch.outputs.branch_exists == 0 }}
env:
API_TOKEN_GITHUB: ${{ secrets.PAT }}
with:
source_file: ${{ inputs.source_dir }}
destination_repo: ${{ inputs.repo }}
destination_folder: ${{ inputs.destination_dir }}
destination_branch_create: ${{ inputs.branch }}
user_email: "[email protected]"
user_name: "Zeta Tokens Bot"
commit_message: "deps(automated): ${{inputs.commit_msg}} ${{ steps.date.outputs.date }}"

- name: Copy files
run: cp -r source/${{ inputs.source_dir }}/* destination/${{ inputs.destination_dir }}

- name: Commit changes
run: |
cd destination
git config --global user.name "zeta-icons-bot"
git config --global user.email "[email protected]"
git add -A
git commit -m "deps(automated): ${{inputs.commit_msg}} ${{ steps.date.outputs.date }}"
git push
# --set-upstream origin ${{steps.branch_name.outputs.BRANCH_NAME}} -f

# - name: Push files if branch exists
# uses: dmnemec/copy_file_to_another_repo_action@main
# if: ${{ steps.check_branch.outputs.branch_exists != 0 }}
# env:
# API_TOKEN_GITHUB: ${{ secrets.PAT }}
# with:
# source_file: ${{ inputs.source_dir }}
# destination_repo: ${{ inputs.repo }}
# destination_folder: ${{ inputs.destination_dir }}
# destination_branch: ${{ inputs.branch }}
# user_email: "[email protected]"
# user_name: "Zeta Tokens Bot"
# commit_message: "deps(automated): ${{inputs.commit_msg}} ${{ steps.date.outputs.date }}"
# - name: Push files if branch does not exist
# uses: dmnemec/copy_file_to_another_repo_action@main
# if: ${{ steps.check_branch.outputs.branch_exists == 0 }}
# env:
# API_TOKEN_GITHUB: ${{ secrets.PAT }}
# with:
# source_file: ${{ inputs.source_dir }}
# destination_repo: ${{ inputs.repo }}
# destination_folder: ${{ inputs.destination_dir }}
# destination_branch_create: ${{ inputs.branch }}
# user_email: "[email protected]"
# user_name: "Zeta Tokens Bot"
# commit_message: "deps(automated): ${{inputs.commit_msg}} ${{ steps.date.outputs.date }}"

- name: Open PR
uses: thecanadianroot/[email protected]
if: ${{ steps.check_pr.outputs.pr_exists == 0 }}
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/update_zds_android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ jobs:
source_dir: "./outputs/android/."
destination_dir: "components/src/main/res/drawable"
commit_msg: "Update icons"
prerun: rm -f components/src/main/res/drawable/ic_*.xml

0 comments on commit f1065ac

Please sign in to comment.