Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 2 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -184,20 +184,14 @@ jobs:
NEW_VERSION: ${{ steps.sampo-release.outputs.new_version }}
COMMIT_HASH: ${{ steps.commit-release.outputs.commit-hash }}
run: |
TAG_SHA=$(gh api "repos/${{ github.repository }}/git/tags" \
-f "tag=v${NEW_VERSION}" \
-f "message=Release v${NEW_VERSION}" \
-f "object=${COMMIT_HASH}" \
-f "type=commit" \
-q '.sha')
gh api "repos/${{ github.repository }}/git/refs" \
-f "ref=refs/tags/v${NEW_VERSION}" \
-f "sha=${TAG_SHA}"
-f "sha=${COMMIT_HASH}"

- name: Create GitHub Release
if: steps.commit-release.outputs.commit-hash != ''
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ steps.releaser.outputs.token }}
Comment on lines -200 to +194
Copy link
Member Author

Choose a reason for hiding this comment

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

Of course attribution wasn't working, we were passing the wrong token.

Copy link
Member Author

Choose a reason for hiding this comment

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

@rafaeelaudibert sanity check: was there an explicit reason this uses the default GITHUB_TOKEN?

Copy link
Member

Choose a reason for hiding this comment

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

I believe 2-fold:

  1. GITHUB_TOKEN had enough permission to do it
  2. I don't think the releaser bots have access to create releases. We always give it "contents: write" permission only, don't know whether that's enough to create a release

Copy link
Member Author

Choose a reason for hiding this comment

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

Creating a release only requires contents: write, so it should be sufficient.

GITHUB_TOKEN had enough permission to do it

I support that 👍 . I suppose the GitHub App is really only needed to be able to push directly to master while bypassing required checks. As of this PR, we also use the App's token to create the release, which isn't strictly necessary. There may be some limited value in the version bump commit and the release being attributed to the same user, but that feels really minor.

NEW_VERSION: ${{ steps.sampo-release.outputs.new_version }}
run: gh release create "v$NEW_VERSION" --generate-notes

Expand Down
5 changes: 5 additions & 0 deletions .sampo/changesets/roguish-king-akka.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
pypi/posthog: patch
---

chore(ci): fix release attribution
Loading