Skip to content

Commit

Permalink
New GitHub Actions workflow files (#12)
Browse files Browse the repository at this point in the history
* Updated GH Actions workflow files

* Add parenthesis
  • Loading branch information
emmahsax authored Sep 25, 2021
1 parent b80ef60 commit 9da94c4
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 18 deletions.
28 changes: 13 additions & 15 deletions .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,23 @@ jobs:
fetch-depth: 0
- name: Set GitLeaks Config
run: |
if [[ ${{ github.REF }} == 'refs/heads'* ]]; then # This is a branch, not a pull request
CURRENT_COMMIT="${{ github.SHA }}"
else
CURRENT_COMMIT="${{ github.EVENT.PULL_REQUEST.HEAD.SHA }}"
fi
echo "COMMITS=$(
git rev-list ${{ github.SHA }} ^origin/main | sed 's/^\|$//g' | paste -sd, -
git rev-list $CURRENT_COMMIT ^origin/main | sed 's/^\|$//g' | paste -sd, -
)" >> $GITHUB_ENV
echo "Title = 'GitLeaks Allowlist'" >> ${{ github.WORKSPACE }}/gitleaks.toml
echo "[allowlist]" >> ${{ github.WORKSPACE }}/gitleaks.toml
echo " commits = ${{ env.GITLEAKS_CONFIG_COMMITS }}" >> ${{ github.WORKSPACE }}/gitleaks.toml
echo " regexes = ${{ env.GITLEAKS_CONFIG_REGEXES }}" >> ${{ github.WORKSPACE }}/gitleaks.toml
- name: GitLeaks
uses: addnab/docker-run-action@v3
with:
image: zricethezav/gitleaks
options: -v ${{ github.WORKSPACE }}:/app
run: |
cd /app
if [[ ${{ github.REF }} == 'refs/heads/main' ]]; then
gitleaks --verbose --additional-config='gitleaks.toml' \
--repo-url='${{ github.SERVER_URL }}/${{ github.REPOSITORY }}' \
--access-token='${{ secrets.GITHUB_TOKEN }}'
else
gitleaks --verbose --additional-config='gitleaks.toml' \
--path='./' --commits='${{ env.COMMITS }}'
fi
run: |
COMMAND="gitleaks --verbose --additional-config='/app/gitleaks.toml' --path='/app'"
if [ ${{ github.REF }} != 'refs/heads/main' ]; then
COMMAND="${COMMAND} --commits='${{ env.COMMITS }}'"
fi
docker pull zricethezav/gitleaks
docker run --rm -v $(pwd):/app -i --entrypoint /bin/bash zricethezav/gitleaks -c "$COMMAND"
2 changes: 1 addition & 1 deletion .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
steps:
- name: Set Branch Variable
run: |
if [[ ${{ github.REF }} == 'refs/heads'* ]]; then # this is a branch, not a pull request
if [[ ${{ github.REF }} == 'refs/heads'* ]]; then # This is a branch, not a pull request
echo "BRANCH=$(echo ${{ github.REF }} | sed -E 's|refs/[a-zA-Z]+/||')" >> $GITHUB_ENV
else
echo "BRANCH=$(echo ${{ github.HEAD_REF }} | sed -E 's|refs/[a-zA-Z]+/||')" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
steps:
- name: Set Branch Variable
run: |
if [[ ${{ github.REF }} == 'refs/heads'* ]]; then # this is a branch, not a pull request
if [[ ${{ github.REF }} == 'refs/heads'* ]]; then # This is a branch, not a pull request
echo "BRANCH=$(echo ${{ github.REF }} | sed -E 's|refs/[a-zA-Z]+/||')" >> $GITHUB_ENV
else
echo "BRANCH=$(echo ${{ github.HEAD_REF }} | sed -E 's|refs/[a-zA-Z]+/||')" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion lib/highline_wrapper/checkbox_question.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ def ask(prompt, choices, options)

private def ask_highline(prompt)
indices = []
super(prompt).to_s.split(',').each { |i| indices << i.strip.to_i - 1 }
super(prompt).to_s.split(',').each { |i| indices << (i.strip.to_i - 1) }
indices
end

Expand Down

0 comments on commit 9da94c4

Please sign in to comment.