Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »
Q&A

Welcome to Software Development on Codidact!

Will you help us build our independent community of developers helping developers? We're small and trying to grow. We welcome questions about all aspects of software development, from design to code to QA and more. Got questions? Got answers? Got code you'd like someone to review? Please join us.

Review Suggested Edit

You can't approve or reject suggested edits because you haven't yet earned the Edit Posts ability.

Approved.
This suggested edit was approved and applied to the post 10 months ago by Alexei‭.

83 / 255
  • None of the below is tested, but logically should work.
  • 1. In your fork, configure probot pull to use the merge strategy instead of its default hardreset. A git merge will mix your changes with the upstream changes, whereas hardreset will 'reset' your fork to look like the upstream. That would be bad since we're adding new files. This involves adding a new file `.github/pull.yml` to the default branch of your fork (in this case `main`). [Docs](https://github.com/wei/pull?tab=readme-ov-file#advanced-usage)
  • ```yml
  • version: "1"
  • rules:
  • - base: main
  • # Not fully sure if this is correct but its either this or 'josephwright/ltx-talk:main'
  • upstream: josephwright:main
  • mergeMethod: merge
  • # Reading the docs, I think this stops merges that have conflicts. We wouldnt expect conflicts in this strategy but if they do occur we want to be notified through the failure so we can address it. Flip to true if its giving you grief.
  • mergeUnstable: false
  • ```
  • 2. In your fork, add a new workflow in the `.github/workflows/` folder that triggers off commits on the main branch. This workflow will use `repository_dispatch` to trigger the workflow in all other repositories. [Docs](https://github.com/peter-evans/repository-dispatch?tab=readme-ov-file#dispatching-an-event-to-a-remote-repository)
  • ```yml
  • name: trigger-remote-repo
  • run-name: Triggering action in remote repository
  • on:
  • push:
  • branches:
  • - main
  • jobs:
  • trigger-remote:
  • runs-on: ubuntu-latest
  • steps:
  • - name: Dispatch event to remote repository
  • uses: peter-evans/repository-dispatch@v4
  • with:
  • token: ${{ secrets.PAT }}
  • repository: samcarter/beamertheme-spectrum
  • event-type: any-old-event-name
  • ```
  • * Note this requires you to setup a [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic) (technically you should use fine-grained-access tokens but that's something I'd go back and fix after getting everything working first.). Then [store that token in secrets with the name PAT](https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets). I would use the organizational secrets which should make that secret available to all your repositories. But if that doesnt work store it directly in the forked repo's secrets.
  • 4. In your personal repository, create/update your workflow to respond to that event. [Example](https://github.com/peter-evans/repository-dispatch?tab=readme-ov-file#example)
  • ```yml
  • name: update-from-upstream
  • run-name: An event occurred in the upstream repository
  • # This is the relevant bit. Make sure the event type matches the name you used in the fork.
  • on:
  • repository_dispatch:
  • types: [any-old-event-name]
  • # Do whatever you need to. I'd assume this'd be the same job as in the cron workflow you already made.
  • jobs:
  • respond-to-event:
  • runs-on: ubuntu-latest
  • steps:
  • - shell: bash
  • run: |
  • echo "Doing whatever I needed to do."
  • ```
  • None of the below is tested, but logically should work.
  • 1. In your fork, configure probot pull to use the merge strategy instead of its default hardreset. A git merge will mix your changes with the upstream changes, whereas hardreset will 'reset' your fork to look like the upstream. That would be bad since we're adding new files. This involves adding a new file `.github/pull.yml` to the default branch of your fork (in this case `main`). [Docs](https://github.com/wei/pull?tab=readme-ov-file#advanced-usage)
  • ```yml
  • version: "1"
  • rules:
  • - base: main
  • # Not fully sure if this is correct but its either this
  • # or 'josephwright/ltx-talk:main'
  • upstream: josephwright:main
  • mergeMethod: merge
  • # Reading the docs, I think this stops merges that have
  • # conflicts. We wouldn't expect conflicts in this strategy,
  • # but if they do occur we want to be notified through the
  • # failure so we can address it. Flip to true if it's giving
  • # you grief.
  • mergeUnstable: false
  • ```
  • 2. In your fork, add a new workflow in the `.github/workflows/` folder that triggers off commits on the main branch. This workflow will use `repository_dispatch` to trigger the workflow in all other repositories. [Docs](https://github.com/peter-evans/repository-dispatch?tab=readme-ov-file#dispatching-an-event-to-a-remote-repository)
  • ```yml
  • name: trigger-remote-repo
  • run-name: Triggering action in remote repository
  • on:
  • push:
  • branches:
  • - main
  • jobs:
  • trigger-remote:
  • runs-on: ubuntu-latest
  • steps:
  • - name: Dispatch event to remote repository
  • uses: peter-evans/repository-dispatch@v4
  • with:
  • token: ${{ secrets.PAT }}
  • repository: samcarter/beamertheme-spectrum
  • event-type: any-old-event-name
  • ```
  • * Note this requires you to set up a [personal access token](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens#creating-a-personal-access-token-classic) (technically you should use fine-grained-access tokens, but that's something I'd go back and fix after getting everything working first.). Then [store that token in secrets with the name PAT](https://docs.github.com/en/actions/how-tos/write-workflows/choose-what-workflows-do/use-secrets). I would use the organizational secrets which should make that secret available to all your repositories. But if that doesn't work store it directly in the forked repo's secrets.
  • 4. In your personal repository, create/update your workflow to respond to that event. [Example](https://github.com/peter-evans/repository-dispatch?tab=readme-ov-file#example)
  • ```yml
  • name: update-from-upstream
  • run-name: An event occurred in the upstream repository
  • # This is the relevant bit. Make sure the event type matches
  • # the name you used in the fork.
  • on:
  • repository_dispatch:
  • types: [any-old-event-name]
  • # Do whatever you need to. I'd assume this'd be the same job
  • # as in the cron workflow you already made.
  • jobs:
  • respond-to-event:
  • runs-on: ubuntu-latest
  • steps:
  • - shell: bash
  • run: |
  • echo "Doing whatever I needed to do."
  • ```

Suggested 10 months ago by Michael‭