Skip to content

Commit

Permalink
add a github action to sync upstream branch to staging
Browse files Browse the repository at this point in the history
  • Loading branch information
roo-ahine committed Sep 4, 2024
1 parent e48b05b commit 861f564
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/sync-repo-with-upstream.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Sync Upstream to Staging

on:

Check warning on line 3 in .github/workflows/sync-repo-with-upstream.yml

View workflow job for this annotation

GitHub Actions / Yamllint

3:1 [truthy] truthy value should be one of [false, true]

Check warning on line 3 in .github/workflows/sync-repo-with-upstream.yml

View workflow job for this annotation

GitHub Actions / Yamllint

3:1 [truthy] truthy value should be one of [false, true]
schedule:
- cron: '35 12 * * *' # Testing during daytime for now

Check failure on line 5 in .github/workflows/sync-repo-with-upstream.yml

View workflow job for this annotation

GitHub Actions / Yamllint

5:59 [trailing-spaces] trailing spaces

Check failure on line 5 in .github/workflows/sync-repo-with-upstream.yml

View workflow job for this annotation

GitHub Actions / Yamllint

5:59 [trailing-spaces] trailing spaces
workflow_dispatch: # Allows manual triggering

Check warning on line 6 in .github/workflows/sync-repo-with-upstream.yml

View workflow job for this annotation

GitHub Actions / Yamllint

6:21 [empty-values] empty value in block mapping

Check warning on line 6 in .github/workflows/sync-repo-with-upstream.yml

View workflow job for this annotation

GitHub Actions / Yamllint

6:21 [empty-values] empty value in block mapping

jobs:
sync:
runs-on: ubuntu-latest

steps:
- name: Checkout the repository

Check warning on line 13 in .github/workflows/sync-repo-with-upstream.yml

View workflow job for this annotation

GitHub Actions / Yamllint

13:5 [indentation] wrong indentation: expected 6 but found 4

Check warning on line 13 in .github/workflows/sync-repo-with-upstream.yml

View workflow job for this annotation

GitHub Actions / Yamllint

13:5 [indentation] wrong indentation: expected 6 but found 4
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Git
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
- name: Add upstream remote
run: git remote add upstream https://github.com/jhaals/yopass.git

- name: Fetch upstream changes
run: git fetch upstream

- name: Checkout staging branch
run: git checkout staging

- name: Merge upstream changes excluding Dockerfile
run: |
git merge upstream/master --no-commit --no-ff
git reset HEAD Dockerfile
git checkout -- Dockerfile
git commit -m "Merge upstream changes excluding Dockerfile" # we have custom changes in Dockerfile we need to retain
- name: Push changes to the staging branch
run: git push origin staging

0 comments on commit 861f564

Please sign in to comment.