Closed agarciadom closed 8 months ago
Nevermind - this only works for README links from public repositories, apparently. When you click on a README link from a private repository, the Referer header only says https://github.com
, so this wouldn't work. Closing as ineffective.
I'm actually not sure what we could do to make it so users can just follow a link - it doesn't look like there is any way to generate a link that references the fork details.
@agarciadom one potential way to update the activities url is to use a GitHub action. The create event is triggered when a new repo is created from the template project inside the same organisation - I tested this behaviour with the following action:
name: Template Test
on: [create, workflow_dispatch]
jobs:
Test-Run:
runs-on: ubuntu-latest
steps:
- run: echo "Action triggered."
- run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
I have tried using Github Classroom to set up an assignment based on a template repository, with the MDENet EP app installed into the classroom's organisation, and this has worked fine.
However, it requires students to manually tweak the
activities
query parameter, which I think is a bit unwieldy. In this PR, I add an alternative which uses theReferrer
header sent by the browser when clicking on a link from the repository'sREADME
file. You would be able to add a link like this to your README:This link would redirect to the
activity.json
file from themain
branch of the repository whose README link we just clicked on, meaning we could set up a template repository and it would always work, so long as the private repo has the appropriate Github app installed.This PR is pending to be tested in our current deployment - Cloudflare is taking a while to revalidate their cache.