Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update package website via cross-repo action dispatch #225

Closed
wants to merge 1 commit into from

Conversation

timwoj
Copy link
Member

@timwoj timwoj commented Nov 1, 2023

This adds a step to the aggregation action that dispatches an action in the package-website repository to notify it of new data. This allows that repo to avoid manually requesting data from the packages repo except only when needed.

@bbannier
Copy link
Contributor

bbannier commented Nov 2, 2023

Just curious, could this be a webhook configured through Github?

Github settings -> webhook screenshot

@timwoj
Copy link
Member Author

timwoj commented Nov 5, 2023

Just curious, could this be a webhook configured through Github?

I tried doing a webhook when I was testing it on another repo, but iirc there were a couple of reasons why it wouldn't work for this:

  1. The event selection isn't fine enough granularity. We only want this to trigger on the aggregation workflow completing, and only on the master branch. The options in the webhook interface only allow you to select workflows starting/stopping.
  2. You can't specify the payload being passed to the webhook, just a URL. For dispatching actions, you have to pass what action should be triggered as data in the request. The data that gets passed is specified by the github webhook itself, so you'd need to add some filtering on the receiving side.

- name: refresh package website
run: |
curl -H "Accept: application/vnd.github+json" \
-H "Authorization: token ${{ secrets.ZEEK_BOT_TOKEN }}" --request POST \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you've tried this with independent repos before Tim, but could you explain the auth mechanism? I'm asking because both this and the packages-website repo has a ZEEK_BOT_TOKEN. Do they need to match for this to work?

All the docs I find only refer to "the repository" when explaining this, which is super helpful when the whole point is to bridge two repositories. :-)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do they need to match for this to work?

Yes, they need to match. That token should be identical between the two repos. It should be the same as the github-notifier token that we keep in 1password, which is a token with full repo permissions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it!

@ckreibich
Copy link
Member

@timwoj I'm just going to close this until we actually need the dispatch. :-)

@ckreibich ckreibich closed this May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants