1
0
mirror of https://github.com/termux/termux-packages synced 2024-06-23 21:37:07 +00:00
termux-packages/.github/workflows/package_updates.yml
Alex fdead17156
chore,ci: use explicit permissions for GitHub Actions
Quoted from #11735:
This commit adds explicit [permissions
section](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#permissions)
to workflows. This is a security best practice because by default
workflows run with [extended set of
permissions](https://docs.github.com/en/actions/security-guides/automatic-token-authentication#permissions-for-the-github_token)
(except from `on: pull_request` [from external
forks](https://securitylab.github.com/research/github-actions-preventing-pwn-requests/)).
By specifying any permission explicitly all others are set to none. By
using the principle of least privilege the damage a compromised workflow
can do (because of an
[injection](https://securitylab.github.com/research/github-actions-untrusted-input/)
or compromised third party tool or action) is restricted.\r\nIt is
recommended to have [most strict permissions on the top
level](https://github.com/ossf/scorecard/blob/main/docs/checks.md#token-permissions)
and grant write permissions on [job
level](https://docs.github.com/en/actions/using-jobs/assigning-permissions-to-jobs)
case by case.

Co-Authored-By: Alex <93376818+sashashura@users.noreply.github.com>
2022-08-28 08:59:01 +05:30

43 lines
1.2 KiB
YAML

name: Package updates
on:
schedule:
- cron: "0 */6 * * *"
workflow_dispatch:
inputs:
packages:
description: "A space-seperated list of packages to update. Defaults to all packages"
default: "@all"
required: false
permissions: {} # none
jobs:
update-packages:
permissions:
issues: write
contents: write
if: github.repository == 'termux/termux-packages'
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ secrets.GH_API_KEY }}
- name: Process package updates
env:
GITHUB_TOKEN: ${{ secrets.GH_API_KEY }}
BUILD_PACKAGES: "true"
GIT_COMMIT_PACKAGES: "true"
GIT_PUSH_PACKAGES: "true"
run: |
git config --global user.name "Termux Github Actions"
git config --global user.email "contact@termux.dev"
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
./scripts/bin/update-packages ${{ github.event.inputs.packages }}
else
./scripts/bin/update-packages "@all"
fi