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

github-action: run GitHub tag/release events #236

Merged
merged 3 commits into from
May 2, 2024

Conversation

v1v
Copy link
Member

@v1v v1v commented Apr 30, 2024

What

Use service machine to support GitHub events, github-bot does not support GitHub events when creating Tags, PRs or Issues, therefore GitHuba actions will not run if they are caused by the above-mentioned user.

In addition, I enabled what @trentm mentioned in #228 (comment)

@v1v v1v requested review from trentm and a team April 30, 2024 11:17
@v1v v1v self-assigned this Apr 30, 2024
@v1v v1v changed the title github-action: run GitHub tag events github-action: run GitHub tag/release events Apr 30, 2024

permissions:
contents: write
contents: read
Copy link
Member

Choose a reason for hiding this comment

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

The GH API to create a release (https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#create-a-release) says it needs:

The token must have at least one of the following permission sets:

contents:write
contents:write and workflows:write

I guess this is bypassing using the GH token for this job and instead is using the CREATE_TAG_TOKEN secret that is manually maintained for this repo?

Copy link
Member Author

Choose a reason for hiding this comment

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

is using the CREATE_TAG_TOKEN secret that is manually maintained for this repo?

Correct. Unfortunately, we cannot use the ephemeral GH token if GitHub events are required.

In this particular the GitHub event is needed, to be able to run the release.yml workflow.

GitHub does not support GitHub events when the actor is the GitHub bot, a way to prevent recursivity

Copy link
Member Author

Choose a reason for hiding this comment

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

https://docs.github.com/en/actions/security-guides/automatic-token-authentication#using-the-github_token-in-a-workflow

When you use the repository's GITHUB_TOKEN to perform tasks, events triggered by the GITHUB_TOKEN, with the exception of workflow_dispatch and repository_dispatch, will not create a new workflow run

@v1v v1v merged commit e61e011 into elastic:main May 2, 2024
3 checks passed
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.

2 participants