Sync develop from goplugin/pluginv3.0 #75
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: Sync develop from goplugin/pluginv3.0 | |
on: | |
schedule: | |
# * is a special character in YAML so you have to quote this string | |
- cron: '*/30 * * * *' | |
jobs: | |
sync: | |
name: Sync | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 | |
with: | |
ref: develop | |
if: env.GITHUB_REPOSITORY != 'goplugin/pluginv3.0' | |
- name: Sync | |
run: | | |
git remote add upstream "https://github.com/goplugin/pluginv3.0.git" | |
COMMIT_HASH_UPSTREAM=$(git ls-remote upstream develop | grep -P '^[0-9a-f]{40}\trefs/heads/develop$' | cut -f 1) | |
COMMIT_HASH_ORIGIN=$(git ls-remote origin develop | grep -P '^[0-9a-f]{40}\trefs/heads/develop$' | cut -f 1) | |
if [ "$COMMIT_HASH_UPSTREAM" = "$COMMIT_HASH_ORIGIN" ]; then | |
echo "Both remotes have develop at $COMMIT_HASH_UPSTREAM. No need to sync." | |
else | |
echo "upstream has develop at $COMMIT_HASH_UPSTREAM. origin has develop at $COMMIT_HASH_ORIGIN. Syncing..." | |
git fetch upstream | |
git push origin upstream/develop:develop | |
fi | |
if: env.GITHUB_REPOSITORY != 'goplugin/pluginv3.0' | |
- name: Collect Metrics | |
if: always() | |
id: collect-gha-metrics | |
uses: goplugin/push-gha-metrics-action@0281b09807758be1dcc41651e44e62b353808c47 # v2.1.0 | |
with: | |
org-id: ${{ secrets.GRAFANA_INTERNAL_TENANT_ID }} | |
basic-auth: ${{ secrets.GRAFANA_INTERNAL_BASIC_AUTH }} | |
hostname: ${{ secrets.GRAFANA_INTERNAL_HOST }} | |
this-job-name: Sync | |
continue-on-error: true |