moodlehq / moodle-plugin-release

Template for GitHub Actions YAML file allowing to automatically release tagged version in the Moodle Plugins directory
GNU General Public License v3.0
13 stars 4 forks source link

Forked plugins #9

Open sharpchi opened 2 years ago

sharpchi commented 2 years ago

This is more a question than an issue, and I think the answer is nothing bad happens!

We use updated forks of a number of plugins. If the plugins, we have forked, contain this code, github is going to try to run this code, isn't it? But it's going to fail because our repository doesn't have the secret from moodle.org. Will github throw errors when it does this - i.e. will it be annoying?

mudrd8mz commented 2 years ago

AFAIK it would trigger the action if the execution condition applies - e.g. when the repository is tagged.

scara commented 2 years ago

Hello Everyone, maybe both of you are right 😉: @sharpchi could align his forked repos by issueing kind of git push --follow-tags against his forked repos and than the trigger described by @mudrd8mz will start the job whenever a tag will be pushed too.

IMHO the Owner could apply a condition like the one below to avoid it:

$ git diff
diff --git a/moodle-release.yml b/moodle-release.yml
index 7518b8d..5f02a8d 100644
--- a/moodle-release.yml
+++ b/moodle-release.yml
@@ -23,6 +23,8 @@ defaults:

 jobs:
   release-at-moodle-org:
+    # This job should not run on forks.
+    if: github.repository_owner == '<your GitHub account>'
     runs-on: ubuntu-latest
     env:
       PLUGIN: <put the frankenstyle component name of your plugin here>

@mudrd8mz if you like it, I can create a PR.

HTH, Matteo

mudrd8mz commented 2 years ago

Does anyone actually does it though or is it just purely theoretical problem? Also, keep in mind that the authorisation will fail if the owner of the fork is not the maintainer of the plugin.

I must say I would like to avoid yet another thing to be edited in the YAML template...

scara commented 2 years ago

Hi @sharpchi, could you provide here more details on how you've triggered that release job in your forks?

TIA, Matteo