Skip to content

Commit

Permalink
add trace to the environment variables only during debug
Browse files Browse the repository at this point in the history
  • Loading branch information
franklychilled committed Feb 26, 2024
1 parent 9921c32 commit 03ca414
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
13 changes: 13 additions & 0 deletions .github/workflows/dependabot_automerge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: Dependabot Workflow
on:
pull_request_target

jobs:
set-token:
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' }}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha }}
token: ${{ secrets.NPM_TOKEN }}
6 changes: 4 additions & 2 deletions hooks/command
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ fi
# shellcheck source=lib/shared.bash
. "$DIR/../lib/shared.bash"

# display all environment variables
env | grep -v TOKEN
if [ "$DEBUG" = "true" ]; then
# display all environment variables except tokens
env | grep -v TOKEN
fi

TOKEN_ENV_NAME="$(plugin_read_config SLACK_TOKEN_ENV_NAME "SLACK_TOKEN")"

Expand Down
13 changes: 8 additions & 5 deletions src/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,14 @@ export const run = async (): Promise<void> => {
suite: [],
};

Object.keys(process.env)
.filter(key => !key.includes("TOKEN"))
.forEach(key => {
console.log(`${key}: ${process.env[key]}`);
});
if (process.env.DEBUG === "true") {
// display all environment variables except tokens
Object.keys(process.env)
.filter(key => !key.includes("TOKEN"))
.forEach(key => {
console.log(`${key}: ${process.env[key]}`);
});
}

const SLACK_TOKEN = process.env.SLACK_TOKEN;
const SLACK_CHANNEL = process.env.SLACK_CHANNEL;
Expand Down

0 comments on commit 03ca414

Please sign in to comment.