Skip to content

Commit

Permalink
Show github context
Browse files Browse the repository at this point in the history
  • Loading branch information
walkowif committed Mar 7, 2024
1 parent 41a2f62 commit 0c8acc1
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 23 deletions.
46 changes: 23 additions & 23 deletions .github/workflows/build-check-install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -231,30 +231,30 @@ jobs:
ref: ${{ steps.branch-name.outputs.head_ref_branch }}
path: ${{ github.event.repository.name }}

# - name: Check commit message 💬
# run: |
# git config --global --add safe.directory $(pwd)
# export head_commit_message="$(git show -s --format=%B | tr '\r\n' ' ' | tr '\n' ' ')"
# echo "head_commit_message = $head_commit_message"
# if [[ $head_commit_message == *"$SKIP_INSTRUCTION"* ]]; then
# echo "Skip instruction detected - cancelling the workflow."
# curl -s -LJ -o gh.tar.gz https://github.com/cli/cli/releases/download/v${GH_CLI_VERSION}/gh_${GH_CLI_VERSION}_linux_amd64.tar.gz
# tar -xzf gh.tar.gz --strip-components 2
# ./gh version
# ./gh run cancel ${{ github.run_id }}
# ./gh run watch ${{ github.run_id }}
# fi
# shell: bash
# env:
# GH_TOKEN: ${{ steps.github-token.outputs.token }}
# GH_CLI_VERSION: 2.44.1
# SKIP_INSTRUCTION: "[skip r-cmd]"

- name: Check commit message 💬
uses: ./r.pkg.template/.github/workflows/check-commit-message
with:
gh-token: ${{ steps.github-token.outputs.token }}
skip-instruction: "[skip r-cmd]"
run: |
git config --global --add safe.directory $(pwd)
export head_commit_message="$(git show -s --format=%B | tr '\r\n' ' ' | tr '\n' ' ')"
echo "head_commit_message = $head_commit_message"
if [[ $head_commit_message == *"$SKIP_INSTRUCTION"* ]]; then
echo "Skip instruction detected - cancelling the workflow."
curl -s -LJ -o gh.tar.gz https://github.com/cli/cli/releases/download/v${GH_CLI_VERSION}/gh_${GH_CLI_VERSION}_linux_amd64.tar.gz
tar -xzf gh.tar.gz --strip-components 2
./gh version
./gh run cancel ${{ github.run_id }}
./gh run watch ${{ github.run_id }}
fi
shell: bash
env:
GH_TOKEN: ${{ steps.github-token.outputs.token }}
GH_CLI_VERSION: 2.44.1
SKIP_INSTRUCTION: "[skip r-cmd]"

# - name: Check commit message 💬
# uses: ./r.pkg.template/.github/workflows/check-commit-message
# with:
# github-token: ${{ steps.github-token.outputs.token }}
# skip-instruction: "[skip r-cmd]"

- name: Checkout gh-pages 🛎
if: >-
Expand Down
6 changes: 6 additions & 0 deletions .github/workflows/roxygen.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,11 @@ jobs:
ref: ${{ steps.branch-name.outputs.head_ref_branch }}
path: ${{ github.event.repository.name }}

- name: Show github context
run: |
echo "head commit message = ${{ toJSON(github.event.head_commit.message) }}"
echo "github context = ${{ toJSON(github) }}
- name: Check commit message 💬
run: |
git config --global --add safe.directory $(pwd)
Expand All @@ -107,6 +112,7 @@ jobs:
./gh run watch ${{ github.run_id }}
fi
shell: bash
working-directory: ${{ github.event.repository.name }}
env:
GH_TOKEN: ${{ steps.github-token.outputs.token }}
GH_CLI_VERSION: 2.44.1
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/test-coverage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,7 @@ jobs:
./gh run watch ${{ github.run_id }}
fi
shell: bash
working-directory: ${{ github.event.repository.name }}
env:
GH_TOKEN: ${{ steps.github-token.outputs.token }}
GH_CLI_VERSION: 2.44.1
Expand Down

0 comments on commit 0c8acc1

Please sign in to comment.