Update Kafka Version Table #524
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 Kafka Version Table | |
on: | |
schedule: | |
- cron: '00 21 * * */1' | |
jobs: | |
update_security_md: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Get Kafka versions | |
run: | | |
versions=$(curl -s https://downloads.apache.org/kafka/ | grep -oP 'href="\K[^"]+' | grep -E '^[0-9]+\.[0-9]+\.[0-9]+/' | sort -rV | sed 's/\/$//') | |
echo "| Version | Supported |" > table.md | |
echo "| ------- | -------------- |" >> table.md | |
while read -r line; do | |
if curl --output /dev/null --silent --head --fail "https://downloads.apache.org/kafka/$line/"; then | |
echo "| $line | :white_check_mark: |" >> table.md | |
else | |
echo "| $line | :x: |" >> table.md | |
fi | |
done <<< "$versions" | |
- name: Update SECURITY.md | |
run: | | |
sed -i -e '/| Version | Supported |/,$ d' SECURITY.md | |
sed -i '/| Version | Supported |/r table.md' SECURITY.md | |
rm table.md | |
- name: Commit changes | |
env: | |
ACCESS_TOKEN: ${{ secrets.gh-action-security-md }} | |
run: | | |
git config --local user.email "[email protected]" | |
git config --local user.name "GitHub Action" | |
git add SECURITY.md | |
if ! git diff-index --quiet HEAD --; then | |
git commit -m "Update Kafka version table - GH Action Pipeline run" | |
git push | |
else | |
echo "No changes to commit. Exiting job as successful." | |
fi |