Add PR template #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Wazuh Decoder & Rule CI Pipeline | |
on: | |
pull_request: | |
branches: | |
- main | |
push: | |
branches: | |
- main | |
jobs: | |
run-wazuh-tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repository | |
uses: actions/checkout@v4 | |
- name: Extract branch name | |
id: extract_branch | |
shell: bash | |
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | |
- name: Get repository URL | |
id: get_repo_url | |
run: echo "repo_url=${{ github.server_url }}/${{ github.repository }}" >> $GITHUB_OUTPUT | |
- name: Check if repository is private | |
id: check_private | |
run: echo "is_private=${{ github.event.repository.private }}" >> $GITHUB_ENV | |
- name: Log in to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- name: Pull Docker image | |
run: docker pull ${{ secrets.DOCKER_IMAGE }} | |
- name: Run container with branch and repo info | |
run: | | |
if [ "${{ env.is_private }}" = "true" ]; then | |
docker run -e BRANCH_NAME=${{ steps.extract_branch.outputs.branch }} \ | |
-e REPO_URL=${{ steps.get_repo_url.outputs.repo_url }} \ | |
-e TOKEN=${{ secrets.TOKEN }} \ | |
${{ secrets.DOCKER_IMAGE }} || exit 1 | |
else | |
docker run -e BRANCH_NAME=${{ steps.extract_branch.outputs.branch }} \ | |
-e REPO_URL=${{ steps.get_repo_url.outputs.repo_url }} \ | |
${{ secrets.DOCKER_IMAGE }} || exit 1 | |
fi | |
- name: Verify container exit status | |
run: echo "Container ran successfully." | |