update the list #22
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: update the list | |
on: | |
schedule: | |
- cron: '0 12 1 * *' | |
workflow_dispatch: | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} # Use GITHUB_TOKEN for checkout | |
- name: Checkout curl.wiki Repository | |
uses: actions/checkout@v3 | |
with: | |
repository: curl/curl.wiki | |
path: curl.wiki | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- run: ls -la # List files in the root directory for debugging | |
- id: check | |
run: | | |
SOURCE_HASH=$(sha256sum curl.wiki/DNS-over-HTTPS.md | cut -d' ' -f1) | |
CUR_HASH=$(head -1 doh-list.txt | sed 's/#*//') | |
if [[ $SOURCE_HASH != $CUR_HASH ]]; then | |
echo "should_compile=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Check for updates and commit if true | |
if: ${{ steps.check.outputs.should_compile == 'true' }} | |
run: | | |
chmod +x ./doh-update.sh # Ensure the script is executable | |
./doh-update.sh # Run the script | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add doh-list.txt | |
git commit -m "Updated doh-list.txt" || echo "No changes to commit" | |
git push |