Actions for GitHub Connector

  • Latest Dynatrace
  • Reference
  • 6-min read
  • Published Aug 23, 2024

The following workflow actions are available for the GitHub Connector GitHub integration.

Required token permissions to run all GitHub actions

Token type

Repository type

Permissions

Fine-grained personal access token

public

Select Repository permissions > Contents > Read and write.

Select Repository permissions > Pull requests > Read and write.

Select Repository permissions > Workflows > Read and write.

Fine-grained personal access token

private

Select Repository permissions > Contents > Read and write.

Select Repository permissions > Pull requests > Read and write.

Select Repository permissions > Workflows > Read and write.

Token (classic)

public

Select scopes > repo > public_repo.

Token (classic)

private

Select scopes > repo (Full control of private repositories).

Get content

The Get content action returns the content of an existing file in the repository.

Input

FieldDescriptionRequired
ConnectionConnection to your GitHub environment.required
OwnerAccount owner of the repository (private user or organization).required
RepositoryThe name of the repository without the .git extension. The name is not case-sensitive.required
File pathThe file path to a single, existing file. A directory path is not supported.required
ReferenceThe name of the commit, branch or tag. If not set, the repository's default branch is used.optional

Output

The action returns the content property that contains the plain text content of an existing file in the repository.

Required token permissions

Token type

Repository type

Permissions

Fine-grained personal access token

public

No additional permissions are required.

Fine-grained personal access token

private

Select Repository permissions > Contents > Read only.

Token (classic)

public

No additional permissions are required.

Token (classic)

private

Select scopes > repo (Full control of private repositories).

Create or replace file

The Create or replace file action creates a new file with the specified content or replaces an existing one. Next, it commits the change to a newly created branch using the specified source branch or the specified existing branch.

Input

FieldDescriptionRequired
ConnectionConnection to your GitHub environment.required
OwnerAccount owner of the repository (private user or organization).required
RepositoryThe name of the repository without the .git extension. The name is not case-sensitive.required
Create new branchSelect this option if you want the change to be made in a new branch.optional
Commit to an existing branchSelect this option if you're going to use an existing branch for the change.optional
Source branchThe source branch on which the new branch is based (for example, "main").optional
BranchThe new or existing branch you want to commit to.required
File pathThe relative path to the file. A directory path is not supported. Existing files will be overwritten.required
File contentThe full content of the file. Existing files will be overwritten.required
Commit messageThe git commit message for the change.required

Output

The action returns the fileMetadata property that contains the full response of the corresponding GitHub API endpoint.

Required token permissions

Token type

Repository type

Permissions

Fine-grained personal access token

public

Select Repository permissions > Contents > Read and write.

Fine-grained personal access token

private

Select Repository permissions > Contents > Read and write.

Select Repository permissions > Workflows > Read and write. (required to modify GitHub workflow files)

Token (classic)

public

Select scopes > repo > public_repo.

Token (classic)

private

Select scopes > repo (Full control of private repositories).

Delete file

The Delete file action deletes an existing file in the repository and commits the change to either a newly created branch using the specified source branch as a basis or uses the specified existing branch.

Input

FieldDescriptionRequired
ConnectionConnection to your GitHub environment.required
OwnerAccount owner of the repository (private user or organization).required
RepositoryThe name of the repository without the .git extension. The name is not case-sensitive.required
Create new branchSelect this option if you want the file deletion to be made in a new branch.optional
Commit to an existing branchSelect this option if you're going to use an existing branch for the change.optional
Source branchThe source branch on which the new branch is based, for instance, "main".optional
BranchThe new or existing branch you want to commit to.required
File pathThe relative path to the file to be deleted. A directory path is not supported.required
Commit messageThe git commit message for the change.required

Output

The action returns the fileMetadata property that contains the full response of the corresponding GitHub API endpoint.

Required token permissions

Token type

Repository type

Permissions

Fine-grained personal access token

public

Select Repository permissions > Contents > Read and write.

Fine-grained personal access token

private

Select Repository permissions > Contents > Read and write.

Token (classic)

public

Select scopes > repo > public_repo.

Token (classic)

private

Select scopes > repo (Full control of private repositories).

Create pull request

The Create pull request action creates a pull request for an existing branch and the specified target branch (for example, main).

Input

FieldDescriptionRequired
ConnectionConnection to your GitHub environment.required
OwnerAccount owner of the repository (private user or organization).required
RepositoryThe name of the repository without the .git extension. The name is not case-sensitive.required
Source branchThe source branch where the changes are implemented.required
Target branchThe target branch you want the changes to be pulled into.required
Pull request titleThe title of the pull request.required
Pull request descriptionThe description of the pull request.optional

Output

The action returns the pullRequest property that contains the full response of the corresponding GitHub API endpoint.

Required permissions

Token type

Repository type

Permissions

Fine-grained personal access token

public

Select Repository permissions > Pull requests > Read and write.

Fine-grained personal access token

private

Select Repository permissions > Pull requests > Read and write.

Token (classic)

public

Select scopes > repo > public_repo.

Token (classic)

private

Select scopes > repo (Full control of private repositories).

Get pull request

The Get pull request action returns details about the specified pull request.

Input

FieldDescriptionRequired
ConnectionConnection to your GitHub environment.required
OwnerAccount owner of the repository (private user or organization).required
RepositoryThe name of the repository without the .git extension. The name is not case-sensitive.required
Pull request numberThe number that identifies the pull request.required

Output

The action returns the pullRequest property that contains the full response of the corresponding GitHub API endpoint.

Required permissions

Token type

Repository type

Permissions

Fine-grained personal access token

public

No additional permissions are required.

Fine-grained personal access token

private

Select Repository permissions > Pull requests > Read-only.

Token (classic)

public

No additional permissions are required.

Token (classic)

private

Select scopes > repo (Full control) of private repositories.

List pull requests

The List pull requests action returns a list of pull requests that match the specified criteria. The limit of 30 pull requests applies.

Input

FieldDescriptionRequired
ConnectionConnection to your GitHub environment.required
OwnerAccount owner of the repository (private user or organization).required
RepositoryThe name of the repository without the .git extension. The name is not case-sensitive.required
StateThe state of pull requests you're interested in (open, closed, all).optional

Output

The action returns the pullRequest property that contains the full response of the corresponding GitHub API endpoint.

Required permissions

Token type

Repository type

Permissions

Fine-grained personal access token

public

No additional permissions are required.

Fine-grained personal access token

private

Select Repository permissions > Pull requests > Read-only.

Token (classic)

public

No additional permissions are required.

Token (classic)

private

Select scopes > repo (Full control of private repositories).

Merge pull request

The Merge pull request action merges the specified pull request.

Input

FieldDescriptionRequired
ConnectionConnection to your GitHub environment.required
OwnerAccount owner of the repository (private user or organization).required
RepositoryThe name of the repository without the .git extension. The name is not case-sensitive.required
Pull request numberThe number that identifies the pull request.required
Merge MethodThe merge method to use.optional

Output

The action returns the mergeStatus property that contains the full response of the corresponding GitHub API endpoint.

Required permissions

Token type

Repository type

Permissions

Fine-grained personal access token

public

Select Repository permissions > Contents > Read and write.

Fine-grained personal access token

private

Select Repository permissions > Contents > Read and write.

Token (classic)

public

Select scopes > repo > public_repo.

Token (classic)

private

Select scopes > repo (Full control of private repositories).

Related tags
Software Delivery