Skip to content

Update Plugins List and Create PR #54

Update Plugins List and Create PR

Update Plugins List and Create PR #54

name: Update Plugins List and Create PR
on:
schedule:
- cron: '30 5 * * 3' # Runs at 5:30 AM UTC on Wednesdays
push:
branches:
- main
workflow_dispatch: # Allows manual execution of the workflow
jobs:
update-and-pr:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Set up environment
run: |
sudo apt-get update
sudo apt-get install -y jq curl parallel
- name: Download plugins.json
run: curl https://updates.jenkins.io/current/update-center.actual.json > plugins.json
- name: Run find-plugin-repos.sh
run: ./find-plugin-repos.sh
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Source config.sh and export variables
id: config_vars
run: |
source config.sh
echo "csv_file_no_jenkinsfile=$csv_file_no_jenkinsfile" >> $GITHUB_ENV
echo "csv_file_without_java_version=$csv_file" >> $GITHUB_ENV
- name: Run create-plugins-list-file.sh
run: |
source config.sh
chmod +x ./create-plugins-list-file.sh
./create-plugins-list-file.sh ${{ env.csv_file_no_jenkinsfile }} plugins.json
mv plugins.txt $plugins_list_no_jenkinsfile_output_file
cp $plugins_list_no_jenkinsfile_output_file $plugins_list_no_jenkinsfile_main_output_file
./create-plugins-list-file.sh ${{ env.csv_file_without_java_version }} plugins.json
mv plugins.txt $plugins_list_old_java_output_file
cp $plugins_list_old_java_output_file $plugins_list_old_java_main_output_file
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cleanup reports
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
DEBUG_MODE: true
run: |
chmod +x ./cleanup-reports.sh
./cleanup-reports.sh
- name: Check for changes
run: |
git diff --exit-code || echo "changed=true" >> $GITHUB_ENV
- name: Configure Git
if: env.changed == 'true'
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
- name: Set dynamic branch name
run: echo "DYNAMIC_BRANCH=update-plugins-$(date +%Y-%m-%d)" >> $GITHUB_ENV
- name: Fetch Default Branch Name
id: fetch_default_branch
run: |
DEFAULT_BRANCH=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
"https://api.github.com/repos/${{ github.repository }}" | jq -r '.default_branch')
echo "DEFAULT_BRANCH=$DEFAULT_BRANCH" >> $GITHUB_ENV
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
branch: ${{ env.DYNAMIC_BRANCH }}
base: main
title: "Update plugins list"
body: "Automatically generated by GitHub Actions."
labels: automated-pr