Skip to content

Commit

Permalink
debug: branch name resolution in PR
Browse files Browse the repository at this point in the history
  • Loading branch information
4141done committed Feb 26, 2024
1 parent 9dbf82b commit ab120e1
Showing 1 changed file with 60 additions and 57 deletions.
117 changes: 60 additions & 57 deletions .github/workflows/dev-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,65 +62,68 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}

- name: Debug branch name
run: echo "GOT BRANCH NAME: ${{ steps.getBranchName.outputs.branch_name }}"

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
# - name: Login to GitHub Container Registry
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.repository_owner }}
# password: ${{ secrets.GITHUB_TOKEN }}

# Docker build setup
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
# # Docker build setup
# - name: Set up QEMU
# uses: docker/setup-qemu-action@v3
# - name: Set up Docker Buildx
# uses: docker/setup-buildx-action@v3

- name: Build and push image [oss]
uses: docker/build-push-action@v5
with:
file: Dockerfile.oss
context: .
push: true
platforms: linux/amd64,linux/arm64
provenance: false
tags: |
ghcr.io/${{ github.repository }}/nginx-oss-s3-gateway-dev:${{ steps.getBranchName.outputs.branch_name }}
# - name: Build and push image [oss]
# uses: docker/build-push-action@v5
# with:
# file: Dockerfile.oss
# context: .
# push: true
# platforms: linux/amd64,linux/arm64
# provenance: false
# tags: |
# ghcr.io/${{ github.repository }}/nginx-oss-s3-gateway-dev:${{ steps.getBranchName.outputs.branch_name }}

- name: Final Comment
run: |
gh api graphql --silent --raw-field query="mutation AddReaction {addReaction(input:{subjectId:\"$NODE_ID\",content:THUMBS_UP}){reaction{content}subject{id}}}"
gh api graphql --silent --raw-field query="mutation RemoveReaction {removeReaction(input:{subjectId:\"$NODE_ID\",content:EYES}){reaction{content}subject{id}}}"
(
echo "**${{ github.workflow }}**"
echo "The long task is done!"
echo
echo "You can find the workflow here:"
echo "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
) | \
gh pr comment "${PR_NUMBER}" --repo ${{ github.repository }} -F -
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}
NODE_ID: ${{ github.event.comment.node_id }}
# - name: Final Comment
# run: |
# gh api graphql --silent --raw-field query="mutation AddReaction {addReaction(input:{subjectId:\"$NODE_ID\",content:THUMBS_UP}){reaction{content}subject{id}}}"
# gh api graphql --silent --raw-field query="mutation RemoveReaction {removeReaction(input:{subjectId:\"$NODE_ID\",content:EYES}){reaction{content}subject{id}}}"
# (
# echo "**${{ github.workflow }}**"
# echo "The long task is done!"
# echo
# echo "You can find the workflow here:"
# echo "${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
# ) | \
# gh pr comment "${PR_NUMBER}" --repo ${{ github.repository }} -F -
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# PR_NUMBER: ${{ github.event.issue.number }}
# NODE_ID: ${{ github.event.comment.node_id }}

notify-job:
runs-on: ubuntu-22.04
needs: [build-and-push-dev-container]
if: ${{ always() && contains(needs.*.result, 'failure') }} <-- check that status of the previous job
steps:
- name: Notify on Failure
run: |
gh api graphql --silent --raw-field query="mutation AddReaction {addReaction(input:{subjectId:\"$NODE_ID\",content:THUMBS_DOWN}){reaction{content}subject{id}}}"
gh api graphql --silent --raw-field query="mutation RemoveReaction {removeReaction(input:{subjectId:\"$NODE_ID\",content:EYES}){reaction{content}subject{id}}}"
(
echo "**${{ github.workflow }}**"
echo "**Something went wrong!**"
echo
echo "**Details:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
) | \
gh pr comment "${PR_NUMBER}" --repo ${{ github.repository }} -F -
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.issue.number }}
NODE_ID: ${{ github.event.comment.node_id }}
# notify-job:
# runs-on: ubuntu-22.04
# needs: [build-and-push-dev-container]
# if: ${{ always() && contains(needs.*.result, 'failure') }} <-- check that status of the previous job
# steps:
# - name: Notify on Failure
# run: |
# gh api graphql --silent --raw-field query="mutation AddReaction {addReaction(input:{subjectId:\"$NODE_ID\",content:THUMBS_DOWN}){reaction{content}subject{id}}}"
# gh api graphql --silent --raw-field query="mutation RemoveReaction {removeReaction(input:{subjectId:\"$NODE_ID\",content:EYES}){reaction{content}subject{id}}}"
# (
# echo "**${{ github.workflow }}**"
# echo "**Something went wrong!**"
# echo
# echo "**Details:** ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}"
# ) | \
# gh pr comment "${PR_NUMBER}" --repo ${{ github.repository }} -F -
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# PR_NUMBER: ${{ github.event.issue.number }}
# NODE_ID: ${{ github.event.comment.node_id }}

0 comments on commit ab120e1

Please sign in to comment.