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

Use GH API to push commits in gihtub actions #3887

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

vgarciabnz
Copy link
Member

@vgarciabnz vgarciabnz commented Nov 18, 2024

Description

This PR uses the DHIS2-bot to create the commit via GH API. In this way, Github automatically signed the commits.

If makes use of a plugin called gh-commit, which wraps the communication with the GH API via GraphQL API.

There is a limitation with protected branches: it seems that is not possible to push to protected branches via GraphQL (or GH API) even if the user is included in the Bypass list. As a workaround, the action creates an auxiliary branch to create the commit via API (so the commit is signed) and then it creates the release/... branch from this auxiliary branch. And deletes the auxiliary branch. This workaround could be avoided if we manage to push commits to protected branches via GH API.

ANDROAPP-6643

Covered unit test cases

Manually tested by triggering GH actions.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code

# Commit and push
git commit -am "Update release notes"
git push
uses: flex-development/[email protected]
Copy link
Collaborator

Choose a reason for hiding this comment

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

does this also push?

Copy link
Member Author

Choose a reason for hiding this comment

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

It creates the commit directly in github, there is no need to push (or it is implicit). The commit does not exist in the local repository. This is why we need to push the changes in the following step.

Copy link

sonarcloud bot commented Nov 19, 2024

@andresmr andresmr marked this pull request as ready for review November 19, 2024 14:44
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