aormsby / Fork-Sync-With-Upstream-action

An action to automatically update your fork with new commits from the upstream repo
MIT License
258 stars 70 forks source link

bump actions/checkout to v3 in sample workflow #65

Closed zkoppert closed 1 year ago

zkoppert commented 1 year ago

v3 is now available https://github.com/marketplace/actions/checkout

zkoppert commented 1 year ago

@aormsby Gently bumping this to see if you could review. Very small change to README.md.

aormsby commented 1 year ago

Updating the README to show v3 in the sample would imply the action has been tested with v3. I haven't had the time to really do that, though.

zkoppert commented 1 year ago

Great point! I have personally been running it with v3 and haven't seen any issues but I understand that may not be enough.

If there is any specific testing I can do for you on this change to help lighten the load of you having to test it yourself, let me know.

aormsby commented 1 year ago

Actually yeah, I'd love the help. This project is really not something I'm working on anymore, so anything you can do will keep it going for you and the community.

If you've already been using v3, that's a pretty good start. Maybe share your config if you can. I'd mostly be concerned about problem cases coming around repo tokens, so if you're already working with combos of public and private repos that could be all we really need to confirm the general safety of using v3.

zkoppert commented 1 year ago

Absolutely! I run this on a public repo but I have also just now tried it on a private repo and it works there too. Here is the output log for the private repo.

1_Sync latest commits from upstream repo.txt

Public repo logs available here

Here is my current config for both the private and public repos using this workflow:

name: 'Upstream Sync'

on:
  schedule:
    - cron:  '0 21 * * 1-6'

  workflow_dispatch:  # click the button on Github repo!

jobs:
  sync_latest_from_upstream:
    runs-on: ubuntu-latest
    name: Sync latest commits from upstream repo

    steps:
    # REQUIRED step
    # Step 1: run a standard checkout action, provided by github
    - name: Checkout target repo
      uses: actions/checkout@v3

    # REQUIRED step
    # Step 2: run the sync action
    - name: Sync upstream changes
      id: sync
      uses: aormsby/Fork-Sync-With-Upstream-action@v3.4
      with:
        target_sync_branch: master
        # REQUIRED 'target_repo_token' exactly like this!
        target_repo_token: ${{ secrets.GITHUB_TOKEN }}
        upstream_sync_branch: master
        upstream_sync_repo: clearlydefined/curated-data

    # Step 3: Display a sample message based on the sync output var 'has_new_commits'
    - name: New commits found
      if: steps.sync.outputs.has_new_commits == 'true'
      run: echo "New commits were found to sync."

    - name: No new commits
      if: steps.sync.outputs.has_new_commits == 'false'
      run: echo "There were no new commits."

    - name: Show value of 'has_new_commits'
      run: echo ${{ steps.sync.outputs.has_new_commits }}

Hope that helps! Let me know if you can think of any other tests I should perform. Appreciate your time in looking at all this!!

aimarket commented 1 year ago

Absolutely! I run this on a public repo but I have also just now tried it on a private repo and it works there too. Here is the output log for the private repo.

1_Sync latest commits from upstream repo.txt

Public repo logs available here

Here is my current config for both the private and public repos using this workflow:

name: 'Upstream Sync'

on:
  schedule:
    - cron:  '0 21 * * 1-6'

  workflow_dispatch:  # click the button on Github repo!

jobs:
  sync_latest_from_upstream:
    runs-on: ubuntu-latest
    name: Sync latest commits from upstream repo

    steps:
    # REQUIRED step
    # Step 1: run a standard checkout action, provided by github
    - name: Checkout target repo
      uses: actions/checkout@v3

    # REQUIRED step
    # Step 2: run the sync action
    - name: Sync upstream changes
      id: sync
      uses: aormsby/Fork-Sync-With-Upstream-action@v3.4
      with:
        target_sync_branch: master
        # REQUIRED 'target_repo_token' exactly like this!
        target_repo_token: ${{ secrets.GITHUB_TOKEN }}
        upstream_sync_branch: master
        upstream_sync_repo: clearlydefined/curated-data

    # Step 3: Display a sample message based on the sync output var 'has_new_commits'
    - name: New commits found
      if: steps.sync.outputs.has_new_commits == 'true'
      run: echo "New commits were found to sync."

    - name: No new commits
      if: steps.sync.outputs.has_new_commits == 'false'
      run: echo "There were no new commits."

    - name: Show value of 'has_new_commits'
      run: echo ${{ steps.sync.outputs.has_new_commits }}

Hope that helps! Let me know if you can think of any other tests I should perform. Appreciate your time in looking at all this!!

Hey this code worked for me I been trying to figure out a solution to fix the issue for 12 hours as a newbie to GitHub actions, I tried switching secrets, setting different permissions to the repo, changing some of the code as well and this was the only thing that solved the issues for me. THANK YOU! @aormsby Hopefully this gets merged soon, so others don't have to struggle like I did.

aormsby commented 1 year ago

Wow, I forgot about this. I updated this, but it's interesting -- there really aren't any changes to release. So the README will ll have v3 on the 'latest' download, but not for any specific release that gets selected. Not sure I can do much about that. 🤷