Skip to content

Update Policy File #105

Update Policy File

Update Policy File #105

name: Update Policy File
on:
schedule:
- cron: '0 0 * * *' # Runs every day at midnight UTC
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
update-mta-sts-policy:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
token: ${{ secrets.ACCESS_TOKEN }}
- name: Fetch current Proton MTA-STS policy
run: |
curl -s https://mta-sts.protonmail.com/.well-known/mta-sts.txt > .well-known/mta-sts.txt
- name: Replace `max_age`
run: |
# Replace max_age with 86400
sed -i 's/^max_age: .*/max_age: 86400/' .well-known/mta-sts.txt
# Replace mode with testing
#sed -i 's/^mode: .*/mode: testing/' .well-known/mta-sts.txt
- name: Check for changes
id: check_changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "[email protected]."
git add .well-known/mta-sts.txt
if git diff --cached --quiet; then
echo "changes=false" >> $GITHUB_ENV
echo "No changes detected."
else
echo "changes=true" >> $GITHUB_ENV
echo "Changes detected."
fi
- name: Commit and push updated file
if: env.changes == 'true'
run: |
git commit -m "Update MTA-STS policy on $(date +'%Y-%m-%d')"
git push