flatcar-scripts/.github/workflows/update-metadata-glsa.yaml
Dongsu Park 9597661ead .github: use personal access token for bot PRs
Use a dedicated personal access token BOT_PR_TOKEN for bot PRs instead
of the default GITHUB_TOKEN. It is needed for triggering another
workflow from pull requests created by Github Actions. The default
GITHUB_TOKEN is by design not able to trigger another workflow.

See also
https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
2023-04-28 15:13:57 +02:00

36 lines
1.3 KiB
YAML

name: Keep GLSA metadata updated
on:
schedule:
- cron: '0 7 1 * *'
workflow_dispatch:
jobs:
keep-glsa-metadata-updated:
runs-on: ubuntu-latest
steps:
- name: Check out scripts
uses: actions/checkout@v3
with:
token: ${{ secrets.BOT_PR_TOKEN }}
- name: Update GLSA metadata
id: update-glsa-metadata
run: |
glsa_dir='sdk_container/src/third_party/portage-stable/metadata/glsa'
rm -rf "${glsa_dir}"
mkdir --parents "${glsa_dir}"
rsync --archive rsync://rsync.gentoo.org/gentoo-portage/metadata/glsa/* "${glsa_dir}"
todaydate=$(date +%Y-%m-%d)
echo "TODAYDATE=${todaydate}" >>"${GITHUB_OUTPUT}"
- name: Create pull request for main branch
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.BOT_PR_TOKEN }}
branch: buildbot/monthly-glsa-metadata-updates-${{steps.update-glsa-metadata.outputs.TODAYDATE }}
delete-branch: true
base: main
title: Monthly GLSA metadata ${{steps.update-glsa-metadata.outputs.TODAYDATE }}
body: Updated GLSA metadata
commit-message: "portage-stable/metadata: Monthly GLSA metadata updates"
author: Flatcar Buildbot <buildbot@flatcar-linux.org>
labels: main