-
Notifications
You must be signed in to change notification settings - Fork 4
fetch locations with auth attempt #385
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
| runs-on: ubuntu-latest | ||
| timeout-minutes: 120 | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: actions/checkout@v4 | ||
| with: | ||
| repository: coursetable/ferry-data | ||
| path: data | ||
| ssh-key: ${{ secrets.REPO_SSH_KEY }} | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Install Packages | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get -y install gcc g++ musl-dev libffi-dev libpq-dev libhdf5-dev python3-tables graphviz libgraphviz-dev | ||
|
|
||
| - name: Set up Python | ||
| uses: actions/setup-python@v4 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install uv and create virtual environment | ||
| run: | | ||
| curl -LsSf https://astral.sh/uv/install.sh | sh | ||
| uv venv .venv | ||
| echo "VIRTUAL_ENV=.venv" >> $GITHUB_ENV | ||
| echo "$PWD/.venv/bin" >> $GITHUB_PATH | ||
|
|
||
| - name: Install dependencies | ||
| run: uv pip install -e . | ||
|
|
||
| - name: Fetch with Locations | ||
| run: | | ||
| SEASON_ARG="" | ||
| if [ -n "${{ github.event.inputs.seasons }}" ]; then | ||
| SEASON_ARG="--seasons ${{ github.event.inputs.seasons }}" | ||
| fi | ||
| TQDM_DISABLE=1 python -u main.py -f config/release_fetch.yml \ | ||
| --database-connect-string "${{ secrets.DATABASE_CONNECT_STRING }}" \ | ||
| --sentry-url "${{ secrets.SENTRY_URL }}" \ | ||
| --cws-api-key "${{ secrets.CWS_API_KEY }}" \ | ||
| --ycs-cookie "${{ github.event.inputs.ycs_cookie }}" \ | ||
| --ycs-pers "${{ github.event.inputs.ycs_pers }}" \ | ||
| $SEASON_ARG | ||
|
|
||
| - name: Sync Postgres DB | ||
| run: TQDM_DISABLE=1 python -u main.py -f config/release_sync_db_courses.yml --database-connect-string ${{ secrets.DATABASE_CONNECT_STRING }} --sentry-url ${{ secrets.SENTRY_URL }} | ||
|
|
||
| - name: Commit updated ferry-data | ||
| uses: stefanzweifel/git-auto-commit-action@v5 | ||
| with: | ||
| commit_message: "Manual Location Sync by ${{ github.actor }}" | ||
| commit_user_name: "Ferry Bot" | ||
| commit_user_email: "[email protected]" | ||
| commit_author: course-table <[email protected]> | ||
| repository: data | ||
| skip_dirty_check: false | ||
|
|
||
| - name: Regenerate static catalog on server | ||
| run: | | ||
| curl --silent --show-error -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" https://api.coursetable.com/api/catalog/refresh | ||
| curl --silent --show-error -H "X-FERRY-SECRET: ${{secrets.FERRY_SECRET}}" https://api-staging.coursetable.com/api/catalog/refresh |
Check warning
Code scanning / CodeQL
Workflow does not contain permissions Medium
Show autofix suggestion
Hide autofix suggestion
Copilot Autofix
AI about 18 hours ago
To fix this, we should explicitly define the minimal GITHUB_TOKEN permissions required for this workflow. The job needs to be able to commit and push changes to the data repository via the git-auto-commit-action, which uses GITHUB_TOKEN by default unless configured otherwise, so it requires contents: write. There is no evidence of needing other GitHub API write scopes (issues, pull-requests, etc.), and reading repository contents is implied by contents: write. The cleanest, non-functional change is to add a permissions block at the workflow root so it applies to all jobs.
Concretely:
- In
.github/workflows/ferry-locations.yml, add a top-levelpermissions:section (aligned withon:andjobs:) specifyingcontents: write. This satisfies the CodeQL requirement (explicit permissions) and enforces least-privilege for the visible operations. - No imports or additional methods are needed because this is YAML configuration only.
- No steps or behavior of the workflow need to change; we are only constraining token permissions.
-
Copy modified lines R16-R18
| @@ -13,6 +13,9 @@ | ||
| required: false | ||
| default: "" | ||
|
|
||
| permissions: | ||
| contents: write | ||
|
|
||
| jobs: | ||
| ferry: | ||
| runs-on: ubuntu-latest |
No description provided.