feat: add new GC rules for release with version #9028
Workflow file for this run
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
name: GIT SYNC | |
on: | |
pull_request_target: | |
types: [opened, synchronize, reopened, labeled] | |
push: | |
delete: | |
jobs: | |
git-sync: | |
if: github.repository == 'erda-project/erda' && (github.event_name == 'push' || github.event_name == 'delete') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: add remote | |
run: git remote add mirror https://${{ secrets.ERDA_CLOUD_MIRROR_GIT_USERNAME }}:${{ secrets.ERDA_CLOUD_MIRROR_GIT_PASSWORD }}@erda.cloud/erda/dop/erda-project/erda | |
- name: push | |
run: git push --tags --force mirror "refs/remotes/origin/*:refs/heads/*" | |
git-sync-pr: | |
if: github.repository == 'erda-project/erda' && github.event_name == 'pull_request_target' && contains(github.event.pull_request.labels.*.name, 'safe to sync') | |
runs-on: ubuntu-latest | |
steps: | |
- name: list open pull requests in last 24 hours | |
id: list | |
uses: andrea-armstrong/github-list-pull-requests@v1.0.0 | |
with: | |
token: ${{secrets.GITHUB_TOKEN}} | |
state: 'open' | |
window: '24' | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: unshallow | |
run: | | |
ss=${{ steps.list.outputs.pullRequestNumbers }} | |
ss=${ss:1:${#ss}-2} | |
IFS=', ' read -r -a arr <<< "$ss" | |
for id in ${arr[@]} | |
do | |
git fetch origin "refs/pull/${id}/head:refs/remotes/origin/feature/pr/${id}" | |
done | |
- name: add remote | |
run: git remote add mirror https://${{ secrets.ERDA_CLOUD_MIRROR_GIT_USERNAME }}:${{ secrets.ERDA_CLOUD_MIRROR_GIT_PASSWORD }}@erda.cloud/erda/dop/erda-project/erda | |
- name: push | |
run: git push --tags --force mirror "refs/remotes/origin/*:refs/heads/*" |