Skip to content

Commit

Permalink
Update create-release.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
fabriziosalmi committed Sep 11, 2023
1 parent c83870b commit 6289aa2
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/create-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,22 +19,30 @@ jobs:
- name: Check out repository code
uses: actions/checkout@v4
with:
fetch-depth: 2 # get current and previous commit
fetch-depth: 0 # Get all commits
ref: main
token: ${{ secrets.PAT }}

# Find the two latest commits where the file changed
- name: Find commits
id: find_commits
run: |
COMMITS=$(git log --pretty=format:'%H' all.fqdn.blacklist.tar.gz | head -2)
echo "::set-output name=commits::$COMMITS"
# Extract current blacklist
- name: Extract current blacklist.txt
run: |
mkdir current
git checkout $(echo "${{ steps.find_commits.outputs.commits }}" | awk '{print $1}')
tar -xzf all.fqdn.blacklist.tar.gz -C current
mv current/all.fqdn.blacklist current/blacklist.txt
# Extract previous blacklist
- name: Extract previous blacklist.txt
run: |
git checkout HEAD^
mkdir previous
git checkout $(echo "${{ steps.find_commits.outputs.commits }}" | awk '{print $2}')
tar -xzf all.fqdn.blacklist.tar.gz -C previous
mv previous/all.fqdn.blacklist previous/blacklist.txt
Expand All @@ -50,7 +58,7 @@ jobs:
run: |
ADDED_COUNT=$(wc -l < added_domains.txt)
REMOVED_COUNT=$(wc -l < removed_domains.txt)
BODY="### Domains Update Summary: Added Domains: $ADDED_COUNT, Removed Domains: $REMOVED_COUNT"
BODY="### Domains Update Summary:\n\n- Added Domains: $ADDED_COUNT\n- Removed Domains: $REMOVED_COUNT"
echo "::set-output name=body::$BODY"
- name: Delete Release if Exists
Expand Down

0 comments on commit 6289aa2

Please sign in to comment.