Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion .github/actions/setup-zizmor-config/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,16 @@ runs:
- name: Ensure default zizmor.yml
shell: bash
run: |
if [ ! -f zizmor.yml ]; then
if [[ ! -f zizmor.yml || $(wc -l < zizmor.yml) -eq 1 ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: patch existing zizmor config, even if it has more than one line

uses yq (yq is installed on Ubuntu according to https://github.com/actions/runner-images/blob/main/images/ubuntu/Ubuntu2404-Readme.md)

      run: |
        # Create zizmor config if missing
        if [[ ! -f zizmor.yml || $(wc -l < zizmor.yml) -eq 1 ]]; thenif [[ ! -f zizmor.yml ]]; then
          echo "Creating a custom zizmor.yml configuration file for CI..."
          cat > zizmor.yml << 'EOF'
        rules:
          dependabot-cooldown:
            disable: trueEOF
        fi

        # Patch (merge) with extra config
        yq -i '
          .rules |= (. // {}) |
          .rules."unpinned-uses" |= (. // {}) |
          .rules."unpinned-uses".config |= (. // {}) |
          .rules."unpinned-uses".config.policies |= (. // {}) |
          .rules."unpinned-uses".config.policies."MiraGeoscience/*" = "any"
        ' zizmor.yml

echo "Creating a custom zizmor.yml configuration file for CI..."
cat > zizmor.yml << 'EOF'
rules:
dependabot-cooldown:
disable: true
unpinned-uses:
config:
policies:
MiraGeoscience/*: any
EOF
else
echo "⊘ Found existing zizmor.yml configuration file"
Expand Down
Loading