pulumi / docs

All things Pulumi docs!
https://pulumi.com
Apache License 2.0
129 stars 221 forks source link

Configure GitHub actions to be opt-in for contributor forks #12124

Open stooj opened 5 months ago

stooj commented 5 months ago

Problem description

When a github user forks this repo in order to contribute to it, there are several github actions that are configured to run on a schedule. They will noisily fail (sending email alerts to the contributor) if they are not properly configured.

So a new (or existing) contributor will sync their fork and then get a lot of action failures until they either configure actions or turn them off.

Suggestions for a fix

Something like:

 jobs:
   sync_latest_from_upstream:
     # Only run this job for events that originate on downstream repos.
-    if: github.repository != 'pulumi/docs'
+    env:
+      github_token: ${{ secrets.GITHUB_TOKEN }}
+    if: github.repository != 'pulumi/docs' && ${{ env.github_token != '' }}
     runs-on: ubuntu-latest
     name: Sync latest commits from upstream repo

List of github actions in this repo and their on: block:

for f in *.yml *.yaml; do echo -n "$f: "; cat "$f" | yq .on | jq --compact-output; done
add-to-project.yml: {"issues":{"types":["opened","reopened"]}}
add-triage-label.yml: {"issues":{"types":["opened","reopened"]}}
automerge-workflow.yml: {"check_suite":{"types":["completed"]},"pull_request":{"types":["labeled","unlabeled","synchronize","opened","edited","ready_for_review","reopened","unlocked"]},"pull_request_review":{"types":["submitted"]},"status":{}}
bucket-cleanup-testing.yml: {"schedule":[{"cron":"0 15 * * *"}],"workflow_dispatch":null}
bucket-cleanup.yml: {"schedule":[{"cron":"0 15 * * *"}]}
build-and-deploy.yml: {"push":{"branches":["master"]}}
check-lighthouse.yml: {"schedule":[{"cron":"0 15 * * *"}],"workflow_dispatch":null}
check-links.yml: {"schedule":[{"cron":"0 15 * * *"}],"workflow_dispatch":null}
check-search-urls.yml: {"schedule":[{"cron":"0 15 * * *"}],"workflow_dispatch":null}
customer-managed-deployment-agent-cli.yml: {"repository_dispatch":{"types":["customer-managed-deployment-agent"]}}
esc-cli.yml: {"repository_dispatch":{"types":["esc-cli"]}}
generate-provider-docs.yml: {"repository_dispatch":{"types":["tfgen-provider","non-resource-provider"]}}
pr-closed.yml: {"pull_request":{"types":["closed"]}}
pull-request.yml: {"pull_request":{"branches":["master"]}}
pulumi-cli-dev-version.yml: {"repository_dispatch":{"types":["pulumi-cli-dev-version"]}}
pulumi-cli.yml: {"repository_dispatch":{"types":["pulumi-cli"]}}
scheduled-test.yml: {"schedule":[{"cron":"0 8 * * *"}],"workflow_dispatch":{}}
scheduled-upgrade-programs.yml: {"schedule":[{"cron":"0 6 * * *"}],"workflow_dispatch":{}}
testing-build-and-deploy.yml: {"push":{"branches":["testing/hugo-retirement-2"]}}
update-search-index.yml: {"schedule":[{"cron":"*/60 * * * *"}],"workflow_dispatch":null}
scheduled-upstream-sync.yaml: {"schedule":[{"cron":"0/15 * * * *"}],"workflow_dispatch":null}
thoward commented 2 weeks ago

@sean1588 can you pick this up where Chris left off?